home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Add-Ons / MPW / MPW dmake 4.0 / man / dmake.tf < prev    next >
Encoding:
Text File  |  1995-06-01  |  107.1 KB  |  2,991 lines  |  [TEXT/MPS ]

  1. .\" Copyright (c) 1990,1991,1992 Dennis Vadura, All rights reserved.
  2. .\"
  3. .ds TB "0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.5i +0.5i +2.0i
  4. .de Ip
  5. .fi
  6. .nr Ip \w'\\$1 'u
  7. .IP "\\$1" \\n(Ipu
  8. \\$2
  9. .nf
  10. ..
  11. .de Is
  12. .nr )I \w'\\$1'u
  13. ..
  14. .de Ii
  15. .in \\n()Ru
  16. .nr )E 1
  17. .ns
  18. .ne 1.1v
  19. .it 1 }N
  20. .di ]B
  21. \&\\$1
  22. ..
  23. .TH DMAKE p  "UW" "Version 3.9 PL0" "Unsupported Free Software"
  24. .SH NAME
  25. \fBdmake\fR \- maintain program groups, or interdependent files
  26. .SH SYNOPSIS
  27. .B dmake
  28. [\-P#] [\-{f|C|K} file] [\-{w|W} target ...]
  29. [macro[[!][*][+][:]]=\fIvalue\fP ...]
  30. [\-v{cdfimt}] [\-ABcdeEghiknpqrsStTuVxX] [target ...]
  31. .SH DESCRIPTION
  32. .PP
  33. .B dmake
  34. is a re-implementation of the UNIX Make utility with significant enhancements.
  35. .B dmake
  36. executes commands found in an external file called a
  37. .I makefile
  38. to update one or more target names.
  39. Each target may depend on zero or more prerequisite targets.
  40. If any of the target's prerequisites is newer than the target or if the target
  41. itself does not exist, then
  42. .B dmake
  43. will attempt to make the target.
  44. .PP
  45. If no
  46. .B \-f
  47. command line option is present then
  48. .B dmake
  49. searches for an existing
  50. .I makefile
  51. from the list of prerequisites specified for the special target \fI.MAKEFILES\fR
  52. (see the STARTUP section for more details).
  53. If "\-" is the name of the file specified to the
  54. .B \-f
  55. flag then \fBdmake\fR uses standard input as the source of the makefile text.
  56. .PP
  57. Any macro definitions (arguments with embedded "="
  58. signs) that appear on the command line are processed first
  59. and supercede definitions for macros of the same name found
  60. within the makefile.  In general it is impossible for definitions found
  61. inside the makefile to redefine a macro defined on the command line, see the
  62. MACROS section for exceptions.
  63. .PP
  64. If no
  65. .I target
  66. names are specified on the command line, then \fBdmake\fR uses the first
  67. non-special target found in the makefile as the default target.
  68. See the
  69. .B "SPECIAL TARGETS"
  70. section for the list of special targets and their function.
  71. Makefiles written for most previous
  72. versions of
  73. .I Make
  74. will be handled correctly by 
  75. .B dmake.
  76. Known differences between \fBdmake\fR and other versions of make
  77. are discussed in the
  78. .B COMPATIBILITY
  79. section found at the end of this document.
  80. .B dmake
  81. returns 0 if no errors were detected and a non-zero result if an error
  82. occurred.
  83. .SH OPTIONS
  84. .IP "\fB\-A\fR"
  85. Enable AUGMAKE special inference rule transformations
  86. (see the "PERCENT(%) RULES" section), these are set to off by default.
  87. .IP "\fB\-B\fR"
  88. Enable the use of spaces instead of <tabs> to begin recipe lines.
  89. This flag equivalent to the .NOTABS special macro and is further described
  90. below.
  91. .IP "\fB\-c\fR"
  92. Use non-standard comment stripping.  If you specify \fB\-c\fP then
  93. .B dmake
  94. will treat any \fB#\fP character as a start of comment character wherever it
  95. may appear unless it is escaped by a \e.
  96. .IP "\fB\-C [+]file\fR"
  97. This option writes to \fIfile\fP a copy of standard output and
  98. standard error from any child processes and from the
  99. .B dmake
  100. process itself.  If you specify a \fB+\fP prior to the file name then
  101. the text is appended to the previous contents of \fIfile\fP.
  102. This option is active in the MSDOS implementation only and is ignored
  103. by non-MSDOS versions of
  104. .B dmake.
  105. .IP "\fB\-d\fR"
  106. Disable the use of the directory cache.  Normally \fBdmake\fP caches directories
  107. as it checks file timestamps.  Giving this flag is equivalent to the
  108. \&.DIRCACHE attribute or macro being set to \fIno\fP.
  109. .IP "\fB\-E\fR"
  110. Read the environment and define all strings of the
  111. form '\fBENV\-VAR\fP=\fIevalue\fP'
  112. defined within as macros whose name is \fBENV\-VAR\fP,
  113. and whose value is '\fIevalue\fP'.
  114. The environment is processed prior to processing the user
  115. specified makefile thereby allowing definitions in the makefile to override
  116. definitions in the environment.
  117. .IP "\fB\-e\fR"
  118. Same as \-E, except that the environment is processed after the
  119. user specified makefile has been processed
  120. (thus definitions in the environment override definitions in the makefile).
  121. The \-e and \-E options are mutually exclusive.
  122. If both are given the latter takes effect.
  123. .IP "\fB\-f file\fR"
  124. Use \fBfile\fR as the source for the makefile text.
  125. Only one \fB\-f\fR option is allowed.
  126. .IP "\fB\-g\fR"
  127. Globally disable group recipe parsing, equivalent to the .IGNOREGROUP
  128. attribute or macro being set to \fIyes\fP at the start of the makefile.
  129. .IP "\fB\-h\fR"
  130. Print the command summary for \fBdmake\fR.
  131. .IP "\fB\-i\fR"
  132. Tells \fBdmake\fR to ignore errors, and continue making other targets.
  133. This is equivalent to the .IGNORE attribute or macro.
  134. .IP "\fB\-K file\fR"
  135. Turns on \fB.KEEP_STATE\fP state tracking and tells \fBdmake\fP to use
  136. \fIfile\fP as the state file.
  137. .IP "\fB\-k\fR"
  138. Causes \fBdmake\fR to ignore errors caused by command execution and to make
  139. all targets not depending on targets that could not be made. 
  140. Ordinarily \fBdmake\fR stops after a command returns a non-zero status,
  141. specifying \fB\-k\fR causes \fBdmake\fR to ignore the error
  142. and continue to make as much as possible.
  143. .IP "\fB\-n\fR"
  144. Causes \fBdmake\fR to print out what it would have executed,
  145. but does not actually execute the commands.  A special check is made for
  146. the string "$(MAKE)" inside a recipe line, if found, the line is expanded
  147. and invoked, thereby enabling recursive makes to give a full
  148. description of all that they will do.
  149. The check for "$(MAKE)" is disabled inside group recipes.
  150. .IP "\fB\-p\fR"
  151. Print out a version of the digested makefile in human readable form.
  152. (useful for debugging, but cannot be re-read by \fBdmake\fP)
  153. .IP "\fB\-P#\fR"
  154. On systems that support multi-processing cause \fBdmake\fP to use \fI#\fP
  155. concurrent child processes to make targets.
  156. See the "MULTI PROCESSING" section for more information.
  157. .IP "\fB\-q\fR"
  158. Check and see if the target is up to date.  Exits with code 0 if up to date,
  159. 1 otherwise.
  160. .IP "\fB\-r\fR"
  161. Tells \fBdmake\fR not to read the initial startup makefile, see STARTUP
  162. section for more details.
  163. .IP "\fB\-s\fR"
  164. Tells \fBdmake\fR to do all its work silently and not echo the commands it is
  165. executing to stdout (also suppresses warnings).
  166. This  is equivalent to the .SILENT attribute or macro.
  167. .IP "\fB\-S\fR"
  168. Force sequential execution of recipes on architectures which support
  169. concurrent makes.  For backward compatibility with old makefiles that have
  170. nasty side-effect prerequisite dependencies.
  171. .IP "\fB\-t\fR"
  172. Causes \fBdmake\fR to touch the targets and bring them up to date
  173. without executing any commands.
  174. Note that targets will not be created if they do not already exist.
  175. .IP "\fB\-T\fR"
  176. Tells \fBdmake\fP to not perform transitive closure on the inference graph.
  177. .IP "\fB\-u\fR"
  178. Force an unconditional update.  (ie. do everything that would
  179. be done if everything that a target depended on was out of date)
  180. .IP "\fB\-v[dfimt]\fR"
  181. Verbose flag, when making targets print to stdout what we are going to make
  182. and what we think its time stamp is.  The optional flags \fB[dfimt]\fP can be
  183. used to restrict the information that is displayed.  In the absence of any
  184. optional flags all are assumed to be given (ie. \fB\-v\fP is equivalent to
  185. \fB\-vdfimt\fP).  The meanings of the optional flags are:
  186. .RS
  187. .IP "\fBd\fP"
  188. Notify of change directory operations only.
  189. .IP "\fBf\fP"
  190. Notify of file I/O operations only.
  191. .IP "\fBi\fP"
  192. Notify of inference algorithm operation only.
  193. .IP "\fBm\fP"
  194. Notify of target update operations only.
  195. .IP "\fBt\fP"
  196. Keep any temporary files created; normally they are automatically deleted.
  197. .RE
  198. .IP "\fB\-V\fR"
  199. Print the version of \fBdmake\fR, and values of builtin macros.
  200. .IP "\fB\-W target\fR"
  201. Run \fBdmake\fP pretending that \fItarget\fP is out of date.
  202. .IP "\fB\-w target\fR"
  203. \fIWhat if?\fP Show what would be made if \fItarget\fP were out of date.
  204. .IP "\fB\-x\fR"
  205. Upon processing the user makefile export all non-internally defined macros
  206. to the user's environment.  This option together with the \-e option
  207. allows SYSV AUGMAKE recursive makes to function as expected.
  208. .IP "\fB\-X\fR"
  209. Inhibit the execution of \fB#!\fP lines found at the beginning of a makefile.
  210. The use of this flag prevents non-termination of recursive make invocations.
  211. .SH INDEX
  212. Here is a list of the sections that follow and a short description of each.
  213. Perhaps you won't have to read the entire man page to find
  214. what you need.
  215. .IP \fBSTARTUP\fP 1.9i
  216. Describes \fBdmake\fP initialization.
  217. .IP \fBSYNTAX\fP 1.9i
  218. Describes the syntax of makefile expressions.
  219. .IP \fBATTRIBUTES\fP 1.9i
  220. Describes the notion of attributes and how they are used when
  221. making targets.
  222. .IP \fBMACROS\fP 1.9i
  223. Defining and expanding macros.
  224. .IP "\fBRULES AND TARGETS" 1.9i
  225. How to define targets and their prerequisites.
  226. .IP \fBRECIPES\fP 1.9i
  227. How to tell \fBdmake\fP how to make a target.
  228. .IP "\fBTEXT DIVERSIONS\fP" 1.9i
  229. How to use text diversions in recipes and macro expansions.
  230. .IP "\fBSPECIAL TARGETS\fP" 1.9i
  231. Some targets are special.
  232. .IP "\fBSPECIAL MACROS\fP" 1.9i
  233. Macros used by \fBdmake\fP to alter the processing of the makefile,
  234. and those defined by \fBdmake\fP for the user.
  235. .IP "\fBCONTROL MACROS\fP" 1.9i
  236. Itemized list of special control macros.
  237. .IP "\fBRUN-TIME MACROS\fP" 1.9i
  238. Discussion of special run-time macros such as $@ and $<.
  239. .IP "\fBFUNCTION MACROS\fP" 1.9i
  240. GNU style function macros, only $(mktmp ...) for now.
  241. .IP "\fBCONDITIONAL MACROS\fP" 1.9i
  242. Target specific conditional macros.
  243. .IP "\fBDYNAMIC PREREQUISITES\fP" 1.9i
  244. Processing of prerequisites which contain macro expansions in their name.
  245. .IP "\fBBINDING TARGETS\fP" 1.9i
  246. The rules that \fBdmake\fP uses to bind
  247. a target to an existing file in the file system.
  248. .IP "\fBPERCENT(%) RULES\fP" 1.9i
  249. Specification of recipes to be used by the inference algorithm.
  250. .IP "\fBMAKING INFERENCES\fP" 1.9i
  251. The rules that \fBdmake\fP uses when inferring how to make a target which
  252. has no explicit recipe.  This and the previous section are really a single
  253. section in the text.
  254. .IP "\fBMAKING TARGETS\fP" 1.9i
  255. How \fBdmake\fP makes targets other than libraries.
  256. .IP "\fBMAKING LIBRARIES\fP" 1.9i
  257. How \fBdmake\fP makes libraries.
  258. .IP "\fBKEEP STATE\fP" 1.9i
  259. A discussion of how .KEEP_STATE works.
  260. .IP "\fBMULTI PROCESSING\fP" 1.9i
  261. Discussion of \fBdmake's\fP parallel make facilities for architectures that
  262. support them.
  263. .IP "\fBCONDITIONALS\fP" 1.9i
  264. Conditional expressions which control the processing of the makefile.
  265. .IP "\fBEXAMPLES\fP" 1.9i
  266. Some hopefully useful examples.
  267. .IP "\fBCOMPATIBILITY\fP" 1.9i
  268. How \fBdmake\fP compares with previous versions of make.
  269. .IP "\fBLIMITS\fP" 1.9i
  270. Limitations of \fBdmake\fP.
  271. .IP \fBPORTABILITY\fP 1.9i
  272. Comments on writing portable makefiles.
  273. .IP \fBFILES\fP 1.9i
  274. Files used by \fBdmake\fP.
  275. .IP "\fBSEE ALSO\fP" 1.9i
  276. Other related programs, and man pages.
  277. .IP "\fBAUTHOR\fP" 1.9i
  278. The guy responsible for this thing.
  279. .IP \fBBUGS\fP 1.9i
  280. Hope not.
  281. .SH STARTUP
  282. When
  283. .B dmake
  284. begins execution it first processes the command line and then processes
  285. an initial startup-makefile.
  286. This is followed by an attempt to locate and process a user supplied makefile.
  287. The startup file defines the default values of all required control macros
  288. and the set of default rules for making targets and inferences.
  289. When searching for the startup makefile,
  290. .B dmake
  291. searches the following locations, in the order specified,
  292. until a startup file is located:
  293. .LP
  294. .RS
  295. .IP 1.
  296. The location given as the value of the macro
  297. MAKESTARTUP defined on the command line.
  298. .IP 2.
  299. The location given as the value of the environment variable MAKESTARTUP
  300. defined in the current environment.
  301. .IP 3.
  302. The location given as the value of the macro
  303. MAKESTARTUP defined internally within \fBdmake\fP.
  304. .RE
  305. .LP
  306. The above search is disabled by specifying the \-r option on the command line.
  307. An error is issued if a startup makefile cannot be found and the \-r
  308. option was not specified.
  309. A user may substitute a custom startup file by defining
  310. the MAKESTARTUP environment variable or by redefining the
  311. MAKESTARTUP macro on the command line.
  312. To determine where
  313. .B dmake
  314. looks for the default startup file, check your environment or issue the command
  315. \fI"dmake \-V"\fP.
  316. .PP
  317. A similar search is performed to locate a default user makefile when no
  318. \fB\-f\fP command line option is specified.
  319. By default, the prerequisite list of the special target .MAKEFILES
  320. specifies the names of possible makefiles and the search order that
  321. \fBdmake\fP should use to determine if one exists.
  322. A typical definition for this target is:
  323. .RS
  324. .sp
  325. \&.MAKEFILES : makefile.mk Makefile makefile
  326. .sp
  327. .RE
  328. \fBdmake\fP will first look for makefile.mk and then the others.
  329. If a prerequisite
  330. cannot be found \fBdmake\fP will try to make it before going on to the next
  331. prerequisite.  For example, makefile.mk can be checked out of an RCS file
  332. if the proper rules for doing so are defined in the startup file.
  333. .PP
  334. If the first line of the user makefile is of the form:
  335. .RS
  336. .sp
  337. \#! command command_args
  338. .sp
  339. .RE
  340. then \fBdmake\fP will expand and run the command prior to reading any
  341. additional input.  If the return code of the command is zero then \fBdmake\fP
  342. will continue on to process the remainder of the user makefile, if the return
  343. code is non-zero then dmake will exit.
  344. .PP
  345. \fBdmake\fP builds the internal dependency graph as it parses a user specified
  346. makefile.  The graph is rooted at the special target \fB.ROOT\fP. .ROOT is the
  347. top level target that dmake builds when it starts to build targets.  All user
  348. specified targets (those from the command line or taken as defaults from
  349. the makefile) are made prerequisites of the special target \fB.TARGETS\fP.
  350. \fBdmake\fP by default creates the relationship that .ROOT depends on .TARGETS
  351. and as a result everything is made.  This approach allows the user to customize, within
  352. their makefile, the order and which, target, is built first.  For example the
  353. default makefiles come with settings for .ROOT that specify:
  354. .sp
  355. .RS
  356. \&.ROOT .PHONY .NOSTATE .SEQUENTIAL : .INIT .TARGETS .DONE
  357. .RE
  358. .sp
  359. with .INIT and .DONE defined as:
  360. .sp
  361. .RS
  362. \&.INIT .DONE :;
  363. .RE
  364. .sp
  365. which nicely emulates the behaviour of Sun's make extensions.  The building of
  366. \&.ROOT's prerequisites is always forced to be sequential.
  367. .SH SYNTAX
  368. This section is a summary of the syntax of makefile statements.
  369. The description is given in a style similar to BNF, where { } enclose
  370. items that may appear zero or more times, and [ ] enclose items that
  371. are optional.  Alternative productions for a left hand side are indicated
  372. by '\(->', and newlines are significant.  All symbols in \fBbold\fP type
  373. are text or names representing text supplied by the user.
  374. .sp 2
  375. .RS
  376. .Ip "Makefile" "\(-> { Statement }"
  377. .Ip "Statement" "\(-> Macro-Definition"
  378. \(-> Conditional-Macro-Definition
  379. \(-> Conditional
  380. \(-> Rule-Definition
  381. \(-> Attribute-Definition
  382. .Ip "Macro-Definition" "\(-> \fBMACRO = LINE\fP"
  383. \(-> \fBMACRO [\fB!\fR]*= LINE\fP
  384. \(-> \fBMACRO [\fB!\fR]:= LINE\fP
  385. \(-> \fBMACRO [\fB!\fR]*:= LINE\fP
  386. \(-> \fBMACRO [\fB!\fR]+= LINE\fP
  387. \(-> \fBMACRO [\fB!\fR]+:= LINE\fP
  388. .Ip "Conditional-Macro-Definition \(-> " "\fBTARGET\fP ?= Macro-Definition"
  389. .Ip "Conditional \(-> " "\fB\&.IF\fR expression"
  390.    Makefile
  391. [ \fB.ELIF\fR expression
  392.    Makefile ]
  393. [ \fB.ELSE\fR
  394.    Makefile ]
  395. \fB\&.END\fR
  396. .Ip "expression" "\(-> \fBLINE\fR"
  397. \(-> \fBSTRING == LINE\fR
  398. \(-> \fBSTRING != LINE\fR
  399. .sp
  400. .Ip "Rule-Definition \(-> " "target-definition"
  401.    [ recipe ]
  402. .PP
  403. target-definition \(-> targets [attrs] op { \fBPREREQUISITE\fP } [\fB;\fR rcp-line]
  404. .Ip "targets" "\(-> target { targets }"
  405. \(-> \fB"\fRtarget\fB"\fR { targets }
  406. .Ip "target" "\(-> special-target"
  407. \(-> \fBTARGET\fR
  408. .Ip "attrs" "\(-> attribute { attrs }"
  409. \(-> \fB"\fRattribute\fB"\fR { attrs }
  410. .Ip "op" "\(-> \fB:\fR { modifier }"
  411. .Ip "modifier" "\(-> \fB:\fR"
  412. \(-> \fB^\fR
  413. \(-> \fB!\fR
  414. \(-> \fB\-\fR
  415. \(-> \fB|\fR
  416. .Ip "recipe" "\(-> { \fBTAB\fR rcp-line }"
  417. \(-> [\fB@\fR][\fB%\fR][\fB\-\fR] \fB[
  418. .Is "recipe \(-> "
  419. .Ii " "
  420.    \fR{ \fBLINE\fR }
  421. .Ii " "
  422. \fB]\fR
  423. .Ip "rcp-line" "\(-> [\fB@\fR][\fB%\fR][\fB\-\fR][\fB+\fR] \fBLINE\fR"
  424. .sp
  425. .Ip Attribute-Definition "\(-> attrs \fB:\fR targets"
  426. .sp
  427. .Ip "attribute"     "\(-> \fB.EPILOG\fR"
  428. \(-> \fB.GROUP\fR
  429. \(-> \fB.IGNORE\fR
  430. \(-> \fB.IGNOREGROUP\fR
  431. \(-> \fB.LIBRARY\fR
  432. \(-> \fB.MKSARGS\fR
  433. \(-> \fB.NOINFER\fR
  434. \(-> \fB.NOSTATE\fR
  435. \(-> \fB.PHONY\fR
  436. \(-> \fB.PRECIOUS\fR
  437. \(-> \fB.PROLOG\fR
  438. \(-> \fB.SETDIR=\fIpath\fP\fR
  439. \(-> \fB.SILENT\fR
  440. \(-> \fB.SEQUENTIAL\fR
  441. \(-> \fB.SWAP\fR
  442. \(-> \fB.USESHELL\fR
  443. \(-> \fB.SYMBOL\fR
  444. \(-> \fB.UPDATEALL\fR
  445. .Ip "special-target" "\(-> \fB.ERROR\fR"
  446. \(-> \fB.EXIT\fR
  447. \(-> \fB.EXPORT\fR
  448. \(-> \fB.GROUPEPILOG\fR
  449. \(-> \fB.GROUPPROLOG\fR
  450. \(-> \fB.IMPORT\fR
  451. \(-> \fB.INCLUDE\fR
  452. \(-> \fB.INCLUDEDIRS\fR
  453. \(-> \fB.MAKEFILES\fR
  454. \(-> \fB.REMOVE\fR
  455. \(-> \fB.SOURCE\fR
  456. \(-> \fB.SOURCE.\fIsuffix\fR
  457. \(-> .\fIsuffix1\fR.\fIsuffix2\fR
  458. .fi
  459. .RE
  460. .sp 1
  461. .PP
  462. Where, \fBTAB\fP represents a <tab> character, \fBSTRING\fP represents an
  463. arbitrary sequence of characters, and
  464. \fBLINE\fP represents a
  465. possibly empty sequence of characters terminated by a non-escaped 
  466. (not immediately preceded by a backslash '\e') new-line character.
  467. \fBMACRO\fP, \fBPREREQUISITE\fP,
  468. and \fBTARGET\fP each represent a string of characters not
  469. including space or tab which respectively form the name of a macro,
  470. prerequisite or target.
  471. The name may itself be a macro expansion expression.
  472. A \fBLINE\fP can be continued over several physical lines by terminating it with
  473. a single backslash character.  Comments are initiated by the
  474. pound \fB#\fR character and extend to the end of line.
  475. All comment text is discarded, a '#' may be placed into the makefile text
  476. by escaping it with '\e' (ie. \e# translates to # when it is parsed).
  477. An exception to this occurs when a # is seen inside
  478. a recipe line that begins with a <tab> or is inside a group recipe.
  479. If you specify the \fB\-c\fP command line switch then this behavior is
  480. disabled and
  481. .B dmake
  482. will treat all # characters as start of comment indicators unless they
  483. are escaped by \e.
  484. A set of continued lines may be commented out by placing a single # at the
  485. start of the first line.
  486. A continued line cannot span more than one makefile.
  487. .PP
  488. \fBwhite space\fP is defined to be any combination of
  489. <space>, <tab>, and the sequence \e<nl>
  490. when \e<nl> is used to terminate a LINE.
  491. When processing \fBmacro\fP definition lines,
  492. any amount of white space is allowed on either side of the macro operator
  493. and white space is stripped from both before and after the macro
  494. value string.
  495. The sequence \e<nl> is treated as white space during recipe expansion
  496. and is deleted from the final recipe string.
  497. You must escape the \e<nl> with another \e in order to get a \e at the end
  498. of a recipe line.
  499. The \e<nl> sequence is deleted from macro values when they are expanded.
  500. .PP
  501. When processing \fBtarget\fP definition lines,
  502. the recipe for a target must, in general, follow the first definition
  503. of the target (See the RULES AND TARGETS section for an exception), and
  504. the recipe may not span across multiple makefiles.
  505. Any targets and prerequisites found on a target definition line are taken
  506. to be white space separated tokens.
  507. The rule operator (\fIop\fP in SYNTAX section) is also considered
  508. to be a token but does not require
  509. white space to precede or follow it.  Since the rule operator begins with a `:',
  510. traditional versions of make do not allow the `:' character to
  511. form a valid target name.  \fBdmake\fP allows `:' to be present in
  512. target/prerequisite names as long as the entire target/prerequisite name is
  513. quoted.  For example:
  514. .sp
  515. \ta:fred : test
  516. .sp
  517. would be parsed as TARGET = a, PREREQUISITES={fred, :, test}, which
  518. is not what was intended.  To fix this you must write:
  519. .sp
  520. \t"a:fred" : test
  521. .sp
  522. Which will be parsed as expected.  Quoted target and prerequisite
  523. specifications may also contain white space thereby allowing the use of
  524. complex function macro expressions..
  525. See the EXAMPLES section for how to apply \fB"\fP quoting
  526. to a list of targets.
  527. .SH ATTRIBUTES
  528. .B dmake
  529. defines several target attributes.  Attributes may be
  530. assigned to a single target, a group of targets, or to all targets in the
  531. makefile.  Attributes are used to modify
  532. \fBdmake\fP actions during target update.
  533. The recognized attributes are:
  534. .sp
  535. .IP \fB.EPILOG\fP 1.2i
  536. Insert shell epilog code when executing a group recipe associated with
  537. any target having this attribute set.
  538. .IP \fB.FIRST\fP 1.2i
  539. Used in conjunction with .INCLUDE.  Terminates the inclusion with the first
  540. successfully included prerequisite.
  541. .IP \fB.GROUP\fP 1.2i
  542. Force execution of a target's recipe as a group recipe.
  543. .IP \fB.IGNORE\fP 1.2i
  544. Ignore an error when trying to make any target with this attribute set.
  545. .IP \fB.IGNOREGROUP\fP 1.2i
  546. Disable the special meaning of '[' to initiate a group recipe.
  547. .IP \fB.LIBRARY\fP 1.2i
  548. Target is a library.
  549. .IP \fB.MKSARGS\fP 1.2i
  550. If running in an MSDOS environment then use MKS extended argument passing
  551. conventions to pass arguments to commands.  Non-MSDOS
  552. environments ignore this attribute.
  553. .IP \fB.NOINFER\fP 1.2i
  554. Any target with this attribute set will not be subjected
  555. to transitive closure if it is inferred as a prerequisite 
  556. of a target whose recipe and prerequisites are being inferred.
  557. (i.e. the inference algorithm will not use any prerequisite with this attribute 
  558. set, as a target)
  559. If specified as '.NOINFER:' (ie. with no prerequisites or targets) then the
  560. effect is equivalent to specifying \fB\-T\fP on the command line.
  561. .IP \fB.NOSTATE\fP 1.2i
  562. Any target with this attribute set will not have command line flag
  563. information stored in the state file if .KEEP_STATE has been enabled.
  564. .IP \fB.PHONY\fP 1.2i
  565. Any target with this attribute set will have its recipe executed
  566. each time the target is made even if a file matching the target name can
  567. be located.  Any targets that have a .PHONY attributed target as a
  568. prerequisite will be made each time the .PHONY attributed prerequisite is
  569. made.
  570. .IP \fB.PRECIOUS\fP 1.2i
  571. Do not remove associated target under any circumstances.
  572. Set by default for any targets whose corresponding files exist in the file
  573. system prior to the execution of \fBdmake\fP.
  574. .IP \fB.PROLOG\fP 1.2i
  575. Insert shell prolog code when executing a group recipe associated with
  576. any target having this attribute set.
  577. .IP \fB.SEQUENTIAL\fP 1.2i
  578. Force a sequential make of the associated target's prerequisites.
  579. .IP \fB.SETDIR\fP 1.2i
  580. Change current working directory to specified directory when making the
  581. associated target.  You must
  582. specify the directory at the time the attribute is specified.  To do this
  583. simply give \fI.SETDIR=path\fP as the attribute.  \fIpath\fP is expanded and
  584. the result is used as the value of the directory to change to.
  585. If \fIpath\fP contains \fB$$@\fP then the name of the target to be built is
  586. used in computing the path to change directory to.
  587. If path is surrounded by single quotes then path is not expanded, and is used
  588. literally as the directory name.
  589. If the \fIpath\fP contains any `:' characters then the entire attribute string
  590. must be quoted using ".
  591. If a target having this attribute set also has the .IGNORE
  592. attribute set then if the change to the specified directory fails it will be
  593. ignored, and no error message will be issued.
  594. .IP \fB.SILENT\fP 1.2i
  595. Do not echo the recipe lines when making any target with this attribute set,
  596. and do not issue any warnings.
  597. .IP \fB.SWAP\fP 1.2i
  598. Under MSDOS
  599. when making a target with this attribute set swap the \fBdmake\fP executable
  600. to disk prior to executing the recipe line.  Also see the '%' recipe line
  601. flag defined in the RECIPES section.
  602. .IP \fB.SYMBOL\fP 1.2i
  603. Target is a library member and is an entry point into a module in the
  604. library.  This attribute is used only when searching a library for a target.
  605. Targets of the form lib((entry)) have this attribute set automatically.
  606. .IP \fB.USESHELL\fP 1.2i
  607. Force each recipe line of a target to be executed using a shell.
  608. Specifying this attribute is equivalent to specifying the '+' character at the
  609. start of each line of a non-group recipe.
  610. .IP \fB.UPDATEALL\fP 1.2i
  611. Indicates that all the targets listed in this rule are updated by the
  612. execution of the accompanying recipe.
  613. A common example is the production of the
  614. .I y.tab.c
  615. and
  616. .I y.tab.h
  617. files by
  618. .B yacc
  619. when it is run on a grammar.  Specifying .UPDATEALL in such a rule
  620. prevents the running of yacc twice, once for the y.tab.c file and once
  621. for the y.tab.h file.  .UPDATEALL targets that are specified in a single rule
  622. are treated as a single target and all timestamps are updated whenever any
  623. target in the set is made.  As a side-effect, \fBdmake\fP internally sorts
  624. such targets in ascending alphabetical order and the value of $@ is always
  625. the first target in the sorted set.
  626. .LP
  627. All attributes are user setable and except for .UPDATEALL, .SETDIR and .MKSARGS
  628. may be used in one of two forms.
  629. The .MKSARGS attribute is restricted to use as a global attribute, and
  630. the use of the .UPDATEALL and .SETDIR attributes is restricted to rules
  631. of the second form only.
  632. .sp
  633. \tATTRIBUTE_LIST : \fItargets\fP
  634. .sp
  635. assigns the attributes specified by ATTRIBUTE_LIST to each target in
  636. .I targets
  637. or
  638. .sp
  639. \t\fItargets\fP ATTRIBUTE_LIST : ...
  640. .sp
  641. assigns the attributes specified by ATTRIBUTE_LIST to each target in
  642. .I targets.
  643. In the first form if
  644. .I targets
  645. is empty (ie. a NULL list), then the
  646. list of attributes will apply to all targets in the makefile
  647. (this is equivalent to the common Make construct of \fI".IGNORE :"\fP
  648. but has been modified to the notion of an attribute instead of
  649. a special target).
  650. Not all of the attributes have global meaning.
  651. In particular, .LIBRARY, .NOSTATE, .PHONY, .SETDIR, .SYMBOL and .UPDATEALL
  652. have no assigned global meaning.
  653. .PP
  654. Any attribute may be used with any target, even with the special targets.
  655. Some combinations are useless (e.g. .INCLUDE .PRECIOUS: ... ),
  656. while others are useful (e.g. .INCLUDE .IGNORE : "file.mk" will not complain
  657. if file.mk cannot be found using the include file search rules,
  658. see the section on SPECIAL TARGETS for a description of .INCLUDE).
  659. If a specified attribute will not be used with the special target a warning
  660. is issued and the attribute is ignored.
  661. .SH MACROS
  662. .B dmake
  663. supports six forms of macro assignment.
  664. .sp
  665. .IP "\fBMACRO = LINE\fP" 1.55i
  666. This is the most common and familiar form of macro assignment.  It assigns
  667. LINE literally as the value of MACRO.
  668. Future expansions of MACRO recursively expand its value.
  669. .IP "\fBMACRO *= LINE\fP" 1.55i
  670. This form behaves exactly as the simple '=' form with the exception that if
  671. MACRO already has a value then the assignment is not performed.
  672. .IP "\fBMACRO := LINE\fP" 1.55i
  673. This form differs from the simple '=' form in that it expands LINE
  674. prior to assigning it as the value of MACRO.
  675. Future expansions of MACRO do not recursively expand its value.
  676. .IP "\fBMACRO *:= LINE\fP" 1.55i
  677. This form behaves exactly as the ':=' form with the exception that if
  678. MACRO already has a value then the assignment and expansion are not performed.
  679. .IP "\fBMACRO += LINE\fP" 1.55i
  680. This form of macro assignment allows macro values to grow.  It takes the
  681. literal value of LINE and appends it to the previous value of MACRO separating
  682. the two by a single space.
  683. Future expansions of MACRO recursively expand its value.
  684. .IP "\fBMACRO +:= LINE\fP" 1.55i
  685. This form is similar to the '+=' form except that the value of LINE is expanded
  686. prior to being added to the value of MACRO.
  687. .PP
  688. Macro expressions specified on the command line allow the macro value
  689. to be redefined within the makefile only if the macro is defined using
  690. the '+=' and '+:=' operators.  Other operators will define a macro that cannot
  691. be further modified.
  692. .PP
  693. Each of the preceeding macro assignment operators may be prefixed by \fB!\fP
  694. to indicate that the assignment should be forced and that no warnings should
  695. be issued.  Thus, specifying \fB!\fP has the effect of silently forcing the
  696. specified macro assignment.
  697. .PP
  698. When \fBdmake\fP defines a non-environment macro it strips leading and
  699. trailing white space from the macro value.
  700. Macros imported from the environment via either the .IMPORT special
  701. target (see the SPECIAL TARGETS section), or the \fB\-e\fP, or \fB\-E\fP flags
  702. are an exception to this rule.  Their values are
  703. always taken literally and white space is never stripped.
  704. In addition, named macros defined using the .IMPORT special target do
  705. not have their values expanded when they are used within a makefile.
  706. In contrast, environment macros that are imported
  707. due to the specification of the \fB\-e\fP or \fB\-E\fP flags
  708. are subject to expansion when used.
  709. .PP
  710. To specify a macro expansion
  711. enclose the name in () or {} and precede it with a dollar sign $.
  712. Thus $(TEST) represents an expansion of the macro variable named TEST.
  713. If TEST is
  714. defined then $(TEST) is replaced by its expanded value.  If TEST is not
  715. defined then $(TEST) expands to the NULL string (this is equivalent to
  716. defining a macro as 'TEST=' ).  A short form may be used for single character
  717. named macros.  In this case the parentheses are optional, and $(I) is
  718. equivalent to $I.
  719. Macro expansion is recursive, hence, if the value string contains an expression
  720. representing a macro expansion, the expansion is performed.  Circular macro
  721. expansions are detected and cause an error to be issued.
  722. .PP
  723. When defining a macro the given macro name is first expanded before being used
  724. to define the macro.  Thus it is possible to define macros whose names
  725. depend on values of other macros.  For example, suppose CWD is defined as
  726. .sp
  727. \tCWD = $(PWD:b)
  728. .sp
  729. then the value of $(CWD) is the name of the current directory.
  730. This can be used to define macros specific to this directory, for
  731. example:
  732. .sp
  733. \t_$(CWD).prt = list of files to print...
  734. .sp
  735. The actual name of the defined macro is a function of the current directory.
  736. A construct such as this is useful when processing a hierarchy of directories
  737. using .SETDIR attributed targets and a collection of small distributed
  738. makefile stubs.
  739. .PP
  740. Macro variables may be defined within the makefile, on the command
  741. line, or imported from the environment.
  742. .PP
  743. .B \fBdmake\fR
  744. supports several non-standard macro expansions:
  745. The first is of the form:
  746. .RS
  747. .IP \fI$(macro_name:modifier_list:modifier_list:...)\fR
  748. .RE
  749. .LP
  750. where
  751. .I modifier_list
  752. is chosen from the set { B or b, D or d, E or e, F or f, I or i, L or l, S or
  753. s, T or t, U or u, ^, + } and
  754. .RS
  755. .sp
  756. .Is "b  "
  757. .Ii "b "
  758. \- file (not including suffix) portion of path names
  759. .Ii "d"
  760. \- directory portion of all path names
  761. .Ii "e"
  762. \- suffix portion of path names
  763. .Ii "f"
  764. \- file (including suffix) portion of path names
  765. .Ii "i"
  766. \- inferred names of targets
  767. .Ii "l"
  768. \- macro value in lower case
  769. .Ii "s"
  770. \- simple pattern substitution
  771. .Ii "t"
  772. \- tokenization.
  773. .Ii "u"
  774. \- macro value in upper case
  775. .Ii "^"
  776. \- prepend a prefix to each token
  777. .Ii "+"
  778. \- append a suffix to each token
  779. .sp
  780. .RE
  781. Thus if we have the example:
  782. .LP
  783. \ttest = d1/d2/d3/a.out f.out d1/k.out
  784. .LP
  785. The following macro expansions produce the values on the right of '\(->' after
  786. expansion.
  787. .RS
  788. .sp
  789. .Is "$(test:s/out/in/:f)   "
  790. .Ii "$(test:d)"
  791. \(-> d1/d2/d3/ d1/
  792. .Ii "$(test:b)"
  793. \(-> a f k
  794. .Ii "$(test:f)"
  795. \(-> a.out f.out k.out
  796. .Ii "${test:db}"
  797. \(-> d1/d2/d3/a f d1/k
  798. .Ii "${test:s/out/in/:f}"
  799. \(-> a.in f.in k.in
  800. .Ii $(test:f:t"+")
  801. \(-> a.out+f.out+k.out
  802. .Ii $(test:e)
  803. \(-> .out .out .out
  804. .Ii $(test:u)
  805. \(-> D1/D2/D3/A.OUT F.OUT D1/K.OUT
  806. .RE
  807. .PP
  808. If a token ends in a string composed from the value of the macro DIRBRKSTR
  809. (ie. ends in a directory separator string, e.g. '/' in UNIX) and you use the
  810. \fB:d\fP modifier then the expansion returns the directory name less the
  811. final directory separator string.  Thus successive pairs of :d modifiers
  812. each remove a level of directory in the token string.
  813. .PP
  814. The tokenization modifier takes all white space separated tokens from the
  815. macro value and separates them by the quoted separator string.  The separator
  816. string may contain the following escape codes \ea => <bel>,
  817. \&\eb => <backspace>, \ef => <formfeed>, \en => <nl>, \er => <cr>,
  818. \&\et => <tab>, \ev => <vertical tab>, \e" => ", and \exxx => <xxx> where
  819. xxx is the octal representation of a character.  Thus the
  820. expansion:
  821. .LP
  822. .RS
  823. .nf
  824. $(test:f:t"+\en")
  825. .RE
  826. produces:
  827. .RS
  828. a.out+
  829. f.out+
  830. k.out
  831. .fi
  832. .RE
  833. .PP
  834. The prefix operator \fB^\fP takes all white space separated tokens from the
  835. macro value and prepends \fIstring\fP to each.
  836. .LP
  837. .RS
  838. .nf
  839. $(test:f:^mydir/)
  840. .RE
  841. produces:
  842. .RS
  843. mydir/a.out mydir/f.out mydir/k.out
  844. .fi
  845. .RE
  846. .PP
  847. The suffix operator \fB+\fP takes all white space separated tokens from the
  848. macro value and appends \fIstring\fP to each.
  849. .LP
  850. .RS
  851. .nf
  852. $(test:b:+.c)
  853. .RE
  854. produces:
  855. .RS
  856. a.c f.c k.c
  857. .fi
  858. .RE
  859. .PP
  860. The next non-standard form of macro expansion allows for recursive macros.
  861. It is possible to specify a $(\fImacro_name\fR) or ${\fImacro_name\fR} expansion
  862. where \fImacro_name\fR contains more $( ... ) or ${ ... } macro expansions
  863. itself.
  864. .PP
  865. For example $(CC$(_HOST)$(_COMPILER)) will first expand CC$(_HOST)$(_COMPILER)
  866. to get a result and use that result as the name of the macro to expand.
  867. This is useful for writing a makefile for more than one target
  868. environment.  As an example consider the following hypothetical case. 
  869. Suppose that _HOST and _COMPILER are imported from the environment
  870. and are set to represent the host machine type and the host compiler
  871. respectively.
  872. .RS
  873. .sp
  874. .nf
  875. CFLAGS_VAX_CC = \-c \-O     # _HOST == "_VAX", _COMPILER == "_CC"
  876. CFLAGS_PC_MSC = \-c \-ML # _HOST == "_PC",  _COMPILER == "_MSC"
  877. .sp
  878. # redefine CFLAGS macro as:
  879. .sp
  880. CFLAGS := $(CFLAGS$(_HOST)$(_COMPILER))
  881. .fi
  882. .sp
  883. .RE
  884. This causes CFLAGS to take on a value that corresponds to the
  885. environment in which the make is being invoked.
  886. .PP
  887. The final non-standard macro expansion is of the form:
  888. .RS
  889. .sp
  890. string1{token_list}string2
  891. .RE
  892. .LP
  893. where string1, string2 and token_list are expanded.  After expansion,
  894. string1 is prepended to each token found in token_list and
  895. string2 is appended to each resulting token from the previous prepend.
  896. string1 and string2 are not delimited by white space
  897. whereas the tokens in token_list are.
  898. A null token in the token list 
  899. is specified using "".
  900. Thus using another example we have:
  901. .RS
  902. .sp
  903. .Is "test/{f1  f2}.o    "
  904. .Ii "test/{f1 f2}.o"
  905. --> test/f1.o test/f2.o
  906. .Ii "test/ {f1 f2}.o"
  907. --> test/ f1.o f2.o
  908. .Ii "test/{f1 f2} .o"
  909. --> test/f1 test/f2 .o
  910. .Ii "test/{""f1""  """"}.o"
  911. --> test/f1.o test/.o
  912. .sp
  913. .Ii and
  914. .sp
  915. .Is "test/{d1 d2}/{f1 f2}.o --> "
  916. .Ii "test/{d1 d2}/{f1 f2}.o --> "
  917. test/d1/f1.o test/d1/f2.o
  918. test/d2/f1.o test/d2/f2.o
  919. .sp
  920. .RE
  921. This last expansion is activated only when the first characters of
  922. .I token_list
  923. appear immediately after the opening '{' with no intervening white space.
  924. The reason for this restriction is the following incompatibility with
  925. Bourne Shell recipes.  The line
  926. .RS
  927. .sp
  928. { echo hello;}
  929. .sp
  930. .RE
  931. is valid /bin/sh syntax; while
  932. .RS
  933. .sp
  934. {echo hello;}
  935. .sp
  936. .RE
  937. is not.
  938. Hence the latter triggers the enhanced macro expansion while the former
  939. causes it to be suppressed.
  940. See the SPECIAL MACROS section for a description of the special macros that
  941. \fBdmake\fP defines and understands.
  942. .SH "RULES AND TARGETS"
  943. A makefile contains a series of entries that specify dependencies.
  944. Such entries are called \fItarget/prerequisite\fP or \fIrule\fP definitions.
  945. Each rule definition
  946. is optionally followed by a set of lines that provide a recipe for updating
  947. any targets defined by the rule.
  948. Whenever
  949. .B dmake
  950. attempts to bring a target up to date and an explicit recipe is provided with
  951. a rule defining the target, that recipe is used to update the
  952. target.  A rule definition begins with a line having the following syntax:
  953. .sp
  954. .RS
  955. .nf
  956. \fI<targets>\fP [\fI<attributes>\fP] \fI<ruleop>\fP [\fI<prerequisites>\fP] [;\fI<recipe>\fP]
  957. .fi
  958. .RE
  959. .sp
  960. .I targets
  961. is a non-empty list of targets.  If the target is a
  962. special target (see SPECIAL TARGETS section below) then it must appear alone
  963. on the rule line.  For example:
  964. .sp
  965. .RS
  966. \&.IMPORT .ERROR : ...
  967. .RE
  968. .sp
  969. is not allowed since both .IMPORT and .ERROR are special targets.
  970. Special targets are not used in the construction of the dependency graph and
  971. will not be made.
  972. .PP
  973. .I attributes
  974. is a possibly empty list of attributes.  Any attribute defined in the
  975. ATTRIBUTES section above may be specified.  All attributes will be applied to
  976. the list of named targets in the rule definition.  No other targets will
  977. be affected.
  978. .sp
  979. .IP NOTE: 0.75i
  980. As stated earlier,
  981. if both the target list and prerequisite list are empty but the attributes
  982. list is not, then the specified attributes affect all targets in the makefile.
  983. .sp
  984. .PP
  985. .I ruleop
  986. is a separator which is used to identify the targets from the prerequisites.
  987. Optionally it also provides a facility for modifying the way in which
  988. .B dmake
  989. handles the making of the associated targets.
  990. In its simplest form the operator is a single ':', and need not be separated
  991. by white space from its neighboring tokens.  It may additionally be followed
  992. by any of the modifiers { !, ^, \-, :, | }, where:
  993. .sp
  994. .IP \fB!\fP
  995. says execute the recipe for the associated targets once for each out of date
  996. prerequisite.  Ordinarily the recipe is executed
  997. once for all out of date prerequisites at the same time.
  998. .IP \fB^\fP
  999. says to insert the specified prerequisites, if any, before any
  1000. other prerequisites already associated with the specified targets.
  1001. In general, it is not useful to specify ^ with an empty
  1002. list of prerequisites.
  1003. .IP \fB\-\fP
  1004. says to clear the previous list of prerequisites before adding
  1005. the new prerequisites.  Thus,
  1006. .sp
  1007. \t.SUFFIXES :
  1008. .br
  1009. \t.SUFFIXES : .a .b
  1010. .sp
  1011. can be replaced by
  1012. .sp
  1013. \t.SUFFIXES :\- .a .b
  1014. .sp
  1015. however the old form still works as expected.  NOTE:  .SUFFIXES is ignored by
  1016. .B dmake
  1017. it is used here simply as an example.
  1018. .IP \fB:\fP
  1019. When the rule operator is not modified by a second ':'
  1020. only one set of rules may be specified for making a target.
  1021. Multiple definitions may be used to add to the
  1022. list of prerequisites that a target depends on.
  1023. However, if a target is multiply defined
  1024. only one definition may specify a recipe
  1025. for making the target.
  1026. .sp
  1027. When a target's rule operator is modified by a second ':'
  1028. (:: for example) then this definition may not be the only
  1029. definition with a recipe for the target.  There may be other :: target
  1030. definition lines that specify a different set of prerequisites with a
  1031. different recipe for updating the target.  
  1032. Any such target is made if any of the definitions
  1033. find it to be out of date
  1034. with respect to the related prerequisites
  1035. and the corresponding recipe is used to update the
  1036. target.  By definition all '::' recipes that are found to be out of date for
  1037. are executed.
  1038. .sp 
  1039. In the following simple example, each rule has a `::' \fIruleop\fP.  In such an
  1040. operator we call the first `:' the operator, and the second `:' the modifier.
  1041. .sp
  1042. .nf
  1043. a.o :: a.c b.h
  1044.    first recipe for making a.o
  1045.  
  1046. a.o :: a.y b.h
  1047.    second recipe for making a.o
  1048. .fi
  1049. .sp
  1050. If a.o is found to be out of date with respect to a.c then the first recipe
  1051. is used to make a.o.  If it is found out of date with respect to a.y then
  1052. the second recipe is used.  If a.o is out of date with respect to
  1053. b.h then both recipes are invoked to make a.o.
  1054. In the last case the order of invocation corresponds to the order in which the
  1055. rule definitions appear in the makefile.
  1056. .IP \fB|\fP
  1057. Is defined only for PERCENT rule target definitions.  When specified it
  1058. indicates that the following construct should be parsed using the old
  1059. semantinc meaning:
  1060. .sp
  1061. .nf
  1062. %.o :| %.c %.r %.f ; some rule
  1063. .sp
  1064. is equivalent to:
  1065. .sp
  1066. %.o : %.c ; some rule
  1067. %.o : %.r ; some rule
  1068. %.o : %.f ; some rule
  1069. .fi
  1070. .PP
  1071. Targets defined using a single `:' operator
  1072. with a recipe may be redefined again with a new recipe by using a
  1073. `:' operator with a `:' modifier.
  1074. This is equivalent to a target having been
  1075. initially defined with a rule using a `:' modifier.
  1076. Once a target is defined using a `:'
  1077. modifier it may not be defined again with a recipe using only the `:' operator
  1078. with no `:' modifier.  In both cases the use of a `:' modifier creates a new
  1079. list of prerequisites and makes it the current prerequisite list for the target.
  1080. The `:' operator with no recipe always modifies the current list
  1081. of prerequisites.
  1082. Thus assuming each of the following definitions has a recipe attached, then:
  1083. .RS
  1084. .sp
  1085. .nf
  1086. joe :  fred ...    (1)
  1087. joe :: more ...    (2)
  1088. .sp
  1089. and
  1090. .sp
  1091. joe :: fred ...    (3)
  1092. joe :: more ...    (4)
  1093. .sp
  1094. .fi
  1095. .RE
  1096. are legal and mean:  add the recipe associated with (2), or (4) to the set
  1097. of recipes for joe, placing them after existing recipes for
  1098. making joe.
  1099. The constructs:
  1100. .RS
  1101. .sp
  1102. .nf
  1103. joe :: fred ...    (5)
  1104. joe : more ...    (6)
  1105. .sp
  1106. and
  1107. .sp
  1108. joe : fred ...    (7)
  1109. joe : more ...    (8)
  1110. .sp
  1111. .fi
  1112. .RE
  1113. are errors since we have two sets of perfectly good recipes for
  1114. making the target.
  1115. .PP
  1116. .I prerequisites
  1117. is a possibly empty list of targets that must be brought up to date before
  1118. making the current target.
  1119. .PP
  1120. .I recipe
  1121. is a short form and allows the user to specify short rule definitions
  1122. on a single line.
  1123. It is taken to be the first recipe line in a larger recipe
  1124. if additional lines follow the rule definition.
  1125. If the semi-colon is present but the recipe line is empty (ie. null string)
  1126. then it is taken
  1127. to be an empty rule.  Any target so defined causes the
  1128. .I "Don't know how to make ..."
  1129. error message to be suppressed when
  1130. .B dmake
  1131. tries to make the target and fails.
  1132. This silence is maintained for rules that are terminated
  1133. by a semicolon and have no following recipe lines, for targets listed on the
  1134. command line, for the first target found in the makefile, and for any target
  1135. having no recipe but containing a list of prerequisites (see the COMPATIBILITY
  1136. section for an exception to this rule if the AUGMAKE (\fB\-A\fP) flag
  1137. was specified.
  1138. .SH "RECIPES"
  1139. The traditional format used by most versions of Make defines the recipe
  1140. lines as arbitrary strings that may contain macro expansions.  They
  1141. follow a rule definition line and may be spaced
  1142. apart by comment or blank lines.
  1143. The list of recipe lines defining the recipe is terminated by a new target
  1144. definition, a macro definition, or end-of-file.
  1145. Each recipe line
  1146. .B MUST
  1147. begin with a \fB<TAB>\fP character which
  1148. may optionally be followed with one or all
  1149. of the characters
  1150. .IR "'@%+\-'" "."
  1151. The
  1152. .I "'\-'"
  1153. indicates that non-zero exit values (ie. errors)
  1154. are to be ignored when this recipe line is executed, the
  1155. .I "'\+'"
  1156. indicates that the current recipe line is to be executed using the shell, the
  1157. .I "'%'"
  1158. indicates that
  1159. .B dmake
  1160. should swap itself out to secondary storage (MSDOS only) before running the
  1161. recipe and the
  1162. .I "'@'"
  1163. indicates that the recipe line should NOT be echoed to the terminal prior to
  1164. being executed.  Each switch is off by default
  1165. (ie. by default, errors are significant, commands are echoed, no swapping is
  1166. done and a shell is
  1167. used only if the recipe line contains a character found in the value of the
  1168. SHELLMETAS macro).
  1169. Global settings activated via command line options or special attribute or
  1170. target names may also affect these settings.
  1171. An example recipe:
  1172. .sp
  1173. .RS
  1174. .nf
  1175. target :
  1176. \tfirst recipe line
  1177. \tsecond recipe line, executed independently of the first.
  1178. \t@a recipe line that is not echoed
  1179. \t\-and one that has errors ignored
  1180. \t%and one that causes dmake to swap out
  1181. \t\+and one that is executed using a shell.
  1182. .fi
  1183. .RE
  1184. .PP
  1185. The second and new format of the recipe block begins the block with the
  1186. character '[' (the open group character) in the last non-white space
  1187. position of a line, and terminates the
  1188. block with the character ']' (the close group character)
  1189. in the first non-white space position of a line.
  1190. In this form each recipe line need not have a leading TAB.  This is
  1191. called a recipe group.  Groups so defined are fed intact as a single
  1192. unit to a shell for execution whenever the corresponding target needs to
  1193. be updated.  If the open group character '[' is preceded
  1194. by one or all of \-, @ or %
  1195. then they apply to the entire group in the same way that they
  1196. apply to single recipe lines.  You may also specify '+' but it is
  1197. redundant as a shell is already being used to run the recipe.
  1198. See the MAKING TARGETS section for a description of how
  1199. .B dmake
  1200. invokes recipes.
  1201. Here is an example of a group recipe:
  1202. .sp
  1203. .RS
  1204. .nf
  1205. target :
  1206. [
  1207. \tfirst recipe line
  1208. \tsecond recipe line
  1209. \tall of these recipe lines are fed to a
  1210. \tsingle copy of a shell for execution.
  1211. ]
  1212. .fi
  1213. .RE
  1214. .sp
  1215. .SH "TEXT DIVERSIONS"
  1216. .B dmake
  1217. supports the notion of text diversions.
  1218. If a recipe line contains the macro expression
  1219. .RS
  1220. .sp
  1221. $(mktmp[,[\fIfile\fP][,\fItext\fP]] \fIdata\fP)
  1222. .sp
  1223. .RE
  1224. then all text contained in the \fIdata\fP expression is expanded and
  1225. is written to a temporary file.  The return
  1226. value of the macro is the name of the temporary file.
  1227. .PP
  1228. .I data
  1229. can be any text and must be separated from the 'mktmp' portion of the
  1230. macro name by white-space.  The only restriction on the data text is that
  1231. it must contain a balanced number of parentheses of the same kind as are
  1232. used to initiate the $(mktmp ...) expression.  For example:
  1233. .sp
  1234. \t$(mktmp $(XXX))
  1235. .sp
  1236. is legal and works as expected, but:
  1237. .sp
  1238. \t$(mktmp text (to dump to file)
  1239. .sp
  1240. is not legal.  You can achieve what you wish by either defining a macro that
  1241. expands to '(' or by using {} in the macro expression; like this:
  1242. .sp
  1243. \t${mktmp text (to dump to file}
  1244. .sp
  1245. Since the temporary file is opened when the
  1246. macro containing the text diversion expression is expanded, diversions may
  1247. be nested and any diversions that are created as part of ':=' macro
  1248. expansions persist for the duration of the
  1249. .B dmake
  1250. run.
  1251. The diversion text may contain
  1252. the same escape codes as those described in the MACROS section.
  1253. Thus if the \fIdata\fP text is to contain new lines they must be inserted
  1254. using the \en escape sequence.  For example the expression:
  1255. .RS
  1256. .sp
  1257. .nf
  1258. all:
  1259.     cat $(mktmp this is a\en\e
  1260.     test of the text diversion\en)
  1261. .fi
  1262. .sp
  1263. .RE
  1264. is replaced by:
  1265. .RS
  1266. .sp
  1267. cat /tmp/mk12294AA
  1268. .sp
  1269. .RE
  1270. where the temporary file contains two lines both of which are terminated
  1271. by a new-line.  If the \fIdata\fP text spans multiple lines in the makefile
  1272. then each line must be continued via the use of a \e.
  1273. A second more illustrative example generates a response file to an MSDOS
  1274. link command:
  1275. .RS
  1276. .sp
  1277. .nf
  1278. OBJ = fred.obj mary.obj joe.obj
  1279. all : $(OBJ)
  1280.     link @$(mktmp $(^:t"+\en")\en)
  1281. .fi
  1282. .sp
  1283. .RE
  1284. The result of making `all' in the second example is the command:
  1285. .RS
  1286. .sp
  1287. link @/tmp/mk02394AA
  1288. .sp
  1289. .RE
  1290. where the temporary file contains:
  1291. .RS
  1292. .sp
  1293. .nf
  1294. fred.obj+
  1295. mary.obj+
  1296. joe.obj
  1297. .fi
  1298. .sp
  1299. .RE
  1300. The last line of the file is terminated by a new-line which is inserted
  1301. due to the \en found at the end of the \fIdata\fP string.
  1302. .PP
  1303. If the optional \fIfile\fP specifier is present then its expanded value
  1304. is the name of the temporary file to create.  Whenever a $(mktmp ...) macro
  1305. is expanded the macro $(TMPFILE) is set to a new temporary file name.  Thus
  1306. the construct:
  1307. .RS
  1308. .sp
  1309. $(mktmp,$(TMPFILE) data)
  1310. .sp
  1311. .RE
  1312. is completely equivalent to not specifying the $(TMPFILE) optional argument.
  1313. Another example that would be useful for MSDOS users with a Turbo-C compiler
  1314. .RS
  1315. .sp
  1316. $(mktmp,turboc.cfg $(CFLAGS))
  1317. .sp
  1318. .RE
  1319. will place the contents of CFLAGS into a local \fIturboc.cfg\fP file.
  1320. The second optional argument, \fItext\fP, if present alters the name
  1321. of the value returned by the $(mktmp ...) macro.
  1322. .PP
  1323. Under MS-DOS text diversions may be a problem.  Many DOS tools require
  1324. that path names which contain directories use the \e character to delimit
  1325. the directories.  Some users however wish to use the '/' to delimit pathnames
  1326. and use environments that allow them to do so.
  1327. The macro USESHELL is set to "yes" if the
  1328. current recipe is forced to use a shell via the .USESHELL or '+' directives,
  1329. otherwise its value is "no".
  1330. The
  1331. .B dmake
  1332. startup files define the macro DIVFILE whose value is either the
  1333. value of TMPFILE or the value of TMPFILE edited to replace any '/' characters
  1334. to the appropriate value based on the current shell and whether it will be
  1335. used to execute the recipe.
  1336. .PP
  1337. Previous versions of
  1338. .B dmake
  1339. defined text diversions using <+, +> strings,
  1340. where <+ started a text diversion and +> terminated one.
  1341. .B dmake
  1342. is backward compatible with this construct only
  1343. if the <+ and +> appear literally
  1344. on the same recipe line or in the same macro value string.  In such instances
  1345. the expression:
  1346. .sp
  1347. \t<+data+>
  1348. .sp
  1349. is mapped to:
  1350. .sp
  1351. \t$(mktmp data)
  1352. .sp
  1353. which is fully output compatible with the earlier construct.  <+, +>
  1354. constructs whose text spans multiple lines must be converted by hand to use
  1355. $(mktmp ...).
  1356. .PP
  1357. If the environment variable TMPDIR is defined then the
  1358. temporary file is placed into the directory specified by that variable.
  1359. A makefile can modify the location of temporary files by
  1360. defining a macro named TMPDIR and exporting it using the .EXPORT special
  1361. target.
  1362. .SH "SPECIAL TARGETS"
  1363. This section describes the special targets that are recognized by \fBdmake\fP.
  1364. Some are affected by attributes and others are not.
  1365. .IP \fB.ERROR\fP 1.4i
  1366. If defined then the recipe associated with this target is executed
  1367. whenever an error condition is detected by \fBdmake\fP.  All attributes that
  1368. can be used with any other target may be used with this target.  Any
  1369. prerequisites of this target will be brought up to date during its processing.
  1370. NOTE:  errors will be ignored while making this target, in extreme cases this
  1371. may cause some problems.
  1372. .IP \fB.EXIT\fP 1.4i
  1373. If this target is encountered while parsing a makefile then the parsing of the
  1374. makefile is immediately terminated at that point.
  1375. .IP \fB.EXPORT\fP 1.4i
  1376. All prerequisites associated with this target are assumed to
  1377. correspond to macro names and they and their values
  1378. are exported to the environment as environment strings at the point in
  1379. the makefile at which this target appears.
  1380. Any attributes specified with this target are ignored.
  1381. Only macros which have been assigned a value in the makefile prior to the
  1382. export directive are exported, macros as yet undefined
  1383. or macros whose value contains any of the characters "+=:*"
  1384. are not exported.
  1385. is suppre
  1386. .IP \fB.IMPORT\fP 1.4i
  1387. Prerequisite names specified for this target are searched for in the
  1388. environment and defined as macros with their value taken from the environment.
  1389. If the special name \fB.EVERYTHING\fP is used as a prerequisite name then
  1390. all environment variables defined in the environment are imported.
  1391. The functionality of the \fB\-E\fP flag can be forced by placing the construct
  1392. \&\fI.IMPORT : .EVERYTHING\fP at the start of a makefile.  Similarly, by
  1393. placing the construct at the end, one can emulate the effect of the \fB\-e\fP
  1394. command line flag.
  1395. If a prerequisite name cannot be found in the environment
  1396. an error message is issued.
  1397. \&.IMPORT accepts the .IGNORE attribute.  When given, it causes \fBdmake\fP
  1398. to ignore the above error.
  1399. See the MACROS section for a description of the processing of imported macro
  1400. values.
  1401. .IP \fB.INCLUDE\fP 1.4i
  1402. Parse another makefile just as if it had been located at the point of the
  1403. \&.INCLUDE in the current makefile.  The list of prerequisites gives the list of
  1404. makefiles to try to read.  If the list contains multiple makefiles then they
  1405. are read in order from left to right.  The following search rules are used
  1406. when trying to locate the file.  If the filename is surrounded by " or just
  1407. by itself then it is searched for in the current directory.  If it is not
  1408. found it is then searched for in each of the directories specified
  1409. as prerequisites of the \&.INCLUDEDIRS special target.
  1410. If the file name is surrounded by < and >, (ie.
  1411. <my_spiffy_new_makefile>) then it is searched for only in the directories
  1412. given by the .INCLUDEDIRS special target.  In both cases if the file name is a
  1413. fully qualified name starting at the root of the file system then it is only
  1414. searched for once, and the .INCLUDEDIRS list is ignored.  .INCLUDE accepts
  1415. the .IGNORE and .SETDIR attributes.  If .IGNORE attribute is given and the file
  1416. cannot be found then \fBdmake\fP continues processing,
  1417. otherwise an error message is generated.
  1418. The .SETDIR attribute causes
  1419. .B dmake
  1420. to change directories to the specified directory prior to attempting the
  1421. include operation.  If all fails \fBdmake\fP attempts to \fImake\fP the file
  1422. to be included.  If making the file fails then \fBdmake\fP terminates unless
  1423. the .INCLUDE directive also specified the .IGNORE attribute.
  1424. If .FIRST is specified along with .INCLUDE then \fBdmake\fP attempts to
  1425. include each named prerequisite and will terminate the inclusion with the
  1426. first prerequisite that results in a successful inclusion.
  1427. .IP \fB.INCLUDEDIRS\fP 1.4i
  1428. The list of prerequisites specified for this target defines the set of
  1429. directories to search when trying to include a makefile.
  1430. .IP \fB.KEEP_STATE\fP 1.4i
  1431. This special target is a synonym for the macro definition
  1432. .sp
  1433. \&\t.KEEP_STATE := _state.mk
  1434. .sp
  1435. It's effect is to turn on STATE keeping and to define \fI_state.mk\fP
  1436. as the state file.
  1437. .IP \fB.MAKEFILES\fP 1.4i
  1438. The list of prerequisites is the set of files to try to read as the default
  1439. makefile.  By default this target is defined as: 
  1440. .sp
  1441. \t\&.MAKEFILES : makefile.mk Makefile makefile
  1442. .sp
  1443. .IP \fB.SOURCE\fP 1.4i
  1444. The prerequisite list of this target defines a set of directories to check
  1445. when trying to locate a target file name.  See the section on BINDING of
  1446. targets for more information.
  1447. .IP \fB.SOURCE.suff\fP 1.4i
  1448. The same as .SOURCE, except that the .SOURCE.suff list is searched first when
  1449. trying to locate a file matching the a target whose name ends in the suffix
  1450. \&.suff.
  1451. .IP \fB.REMOVE\fP 1.4i
  1452. The recipe of this target is used whenever \fBdmake\fP needs to remove
  1453. intermediate targets that were made but do not need to be kept around.
  1454. Such targets result from the application of transitive closure on the
  1455. dependency graph.
  1456. .PP
  1457. In addition to the special targets above,
  1458. several other forms of targets are recognized and are considered special,
  1459. their exact form and use is defined in the sections that follow.
  1460. .SH "SPECIAL MACROS"
  1461. .B dmake
  1462. defines a number of special macros.  They are divided into three classes:
  1463. control macros, run-time macros, and function macros.
  1464. The control macros are used by
  1465. .B dmake
  1466. to configure its actions, and are the preferred method of doing so.
  1467. In the case when a control macro has the same function as a special 
  1468. target or attribute they share the same name as the special target or
  1469. attribute.
  1470. The run-time macros are defined when
  1471. .B dmake
  1472. makes targets and may be used by the user inside recipes.
  1473. The function macros provide higher level functions dealing with macro
  1474. expansion and diversion file processing.
  1475. .SH "CONTROL MACROS"
  1476. To use the control macros simply assign them a value just like any other
  1477. macro.  The control macros are divided into three groups:
  1478. string valued macros, character valued macros, and boolean valued macros.
  1479. .PP
  1480. The following are all of the string valued macros.
  1481. This list is divided into two groups.  The first group gives the string
  1482. valued macros that are defined internally and cannot be directly set by the
  1483. user.
  1484. .IP \fBINCDEPTH\fP 1.6i
  1485. This macro's value is a string of digits representing
  1486. the current depth of makefile inclusion.
  1487. In the first makefile level this value is zero.
  1488. .IP \fBMFLAGS\fP 1.6i
  1489. Is the list of flags
  1490. that were given on the command line including a leading switch character.
  1491. The \-f flag is not included in this list.
  1492. .IP \fBMAKECMD\fP 1.6i
  1493. Is the name with which \fBdmake\fP was invoked.
  1494. .IP \fBMAKEDIR\fP 1.6i
  1495. Is the full path to the initial directory in which
  1496. .B dmake
  1497. was invoked.
  1498. .IP \fBMAKEFILE\fP 1.6i
  1499. Contains the string "\-f \fImakefile\fP" where, \fImakefile\fP is the name
  1500. of initial user makefile that was first read.
  1501. .IP \fBMAKEFLAGS\fP 1.6i
  1502. Is the same as $(MFLAGS) but has no leading switch
  1503. character. (ie. MFLAGS = \-$(MAKEFLAGS))
  1504. .IP \fBMAKEMACROS\fP 1.6i
  1505. Contains the complete list of macro expressions that were specified on the
  1506. command line.
  1507. .IP \fBMAKETARGETS\fP 1.6i
  1508. Contains the name(s) of the target(s), if any, that were
  1509. specified on the command line.
  1510. .IP \fBMAXPROCESSLIMIT\fP 1.6i
  1511. Is a numeric string representing the maximum number of processes that 
  1512. \fBdmake\fP can use when making targets using parallel mode.
  1513. .IP \fBNULL\fP 1.6i
  1514. Is permanently defined to be the NULL string.
  1515. This is useful when comparing a conditional expression to an NULL value.
  1516. .IP \fBPWD\fP 1.6i
  1517. Is the full path to the
  1518. current directory in which make is executing.
  1519. .IP \fBTMPFILE\fP 1.6i
  1520. Is set to the name of the most recent temporary file opened by \fBdmake\fP.
  1521. Temporary files are used for text diversions and for group recipe processing.
  1522. .IP \fBTMD\fP 1.6i
  1523. Stands for "To Make Dir", and
  1524. is the path from the present directory (value of $(PWD)) to the directory
  1525. that \fBdmake\fP was started up in (value of $(MAKEDIR)).
  1526. This macro is modified when .SETDIR attributes are processed.
  1527. .IP \fBUSESHELL\fP 1.6i
  1528. The value of this macro is set to "yes" if the current recipe is forced to
  1529. use a shell for its execution via the .USESHELL or '+' directives, its value
  1530. is "no" otherwise.
  1531. .sp
  1532. .PP
  1533. The second group of string valued macros control
  1534. .B dmake
  1535. behavior and may be set by the user.
  1536. .IP \fB.DIRCACHE\fP 1.6i
  1537. If set to "yes" enables the directory cache (this is the default).  If set to
  1538. "no" disables the directory cache (equivalent to -d commandline flag).
  1539. .IP \fB.NAMEMAX\fP 1.6i
  1540. Defines the maximum length of a filename component.  The value of the variable
  1541. is initialized at startup to the value of the compiled macro NAME_MAX.  On
  1542. some systems the value of NAME_MAX is too short by default.  Setting a new
  1543. value for .NAMEMAX will override the compiled value.
  1544. .IP \fB.NOTABS\fP 1.6i
  1545. When set to non-NULL enables the use of spaces as well as <tabs> to begin
  1546. recipe lines.
  1547. By default a non\-group recipe is terminated by a line without any leading
  1548. white\-space or by a line not beggining with a <tab> character.
  1549. Enabling this mode modifies the first condition of
  1550. the above termination rule to terminate a
  1551. non\-group recipe with a line that contains only white\-space.
  1552. This mode does not effect the parsing of group recipes bracketed by [].
  1553. .IP \fBAUGMAKE\fP 1.6i
  1554. If set to a non NULL value will enable the transformation of special
  1555. meta targets to support special AUGMAKE inferences (See the COMPATIBILITY
  1556. section).
  1557. .IP \fBDIRBRKSTR\fP 1.6i
  1558. Contains the string of chars used to terminate
  1559. the name of a directory in a pathname.
  1560. Under UNIX its value is "/", under MSDOS its value is "/\e:".
  1561. .IP \fBDIRSEPSTR\fP 1.6i
  1562. Contains the string that is used to separate directory components when
  1563. path names are constructed.  It is defined with a default value at startup.
  1564. .IP \fBDIVFILE\fP 1.6i
  1565. Is defined in the startup file and gives the name that should be returned for
  1566. the diversion file name when used in
  1567. $(mktmp ...) expansions, see the TEXT DIVERSION section for details.
  1568. .IP \fBDYNAMICNESTINGLEVEL\fP 1.6i
  1569. Specifies the maximum number of recursive dynamic macro expansions.  Its
  1570. initial value is 100.
  1571. .IP \fB.KEEP_STATE\fP 1.6i
  1572. Assigning this macro a value tells
  1573. .B dmake
  1574. the name of the state file to use and turns on the keeping of state
  1575. information for any targets that are brought up to date by the make.
  1576. .IP \fBGROUPFLAGS\fP 1.6i
  1577. This macro gives the set of flags to pass to the shell when
  1578. invoking it to execute a group recipe.  The value of the macro is the
  1579. list of flags with a leading switch indicator.  (ie. `\-' under UNIX)
  1580. .IP \fBGROUPSHELL\fP 1.6i
  1581. This macro defines the full
  1582. path to the executable image to be used as the shell when
  1583. processing group recipes.  This macro must be defined if group recipes are
  1584. used.  It is assigned a default value in the startup makefile.  Under UNIX
  1585. this value is /bin/sh.
  1586. .IP \fBGROUPSUFFIX\fP 1.6i
  1587. If defined, this macro gives the string to use as a suffix
  1588. when creating group recipe files to be handed to the command interpreter.
  1589. For example, if it is defined as .sh, then all
  1590. temporary files created by \fBdmake\fP will end in the suffix .sh.
  1591. Under MSDOS if you are using command.com as your GROUPSHELL, then this suffix
  1592. must be set to .bat in order for group recipes to function correctly.
  1593. The setting of GROUPSUFFIX and GROUPSHELL is done automatically for
  1594. command.com in the startup.mk files.
  1595. .IP \fBMAKE\fP 1.6i
  1596. Is defined in the startup file by default.
  1597. The string $(MAKE) is recognized when
  1598. using the \-n option for single line recipes.  Initially this macro is defined
  1599. to have the value "$(MAKECMD) $(MFLAGS)".
  1600. .IP \fBMAKESTARTUP\fP 1.6i
  1601. This macro defines the full path to the initial startup
  1602. makefile.  Use the \fB\-V\fP command line option to discover its initial
  1603. value.
  1604. .IP \fBMAXLINELENGTH\fP 1.6i
  1605. This macro defines the maximum size of a single line of
  1606. makefile input text.  The size is specified as a number, the default value
  1607. is defined internally and is shown via the \fB\-V\fP option.
  1608. A buffer of this size plus 2 is allocated for reading makefile text.  The
  1609. buffer is freed before any targets are made, thereby allowing files containing
  1610. long input lines to be processed without consuming memory during the actual
  1611. make.
  1612. This macro can only be used to extend the line length beyond it's default
  1613. minimum value.
  1614. .IP \fBMAXPROCESS\fP 1.6i
  1615. Specify the maximum number of child processes to use when making targets.
  1616. The default value of this macro is "1" and its value cannot exceed the value
  1617. of the macro MAXPROCESSLIMIT.  Setting the value of MAXPROCESS on the command
  1618. line or in the makefile is equivalent to supplying a corresponding value to
  1619. the -P flag on the command line.
  1620. .IP \fBPREP\fP 1.6i
  1621. This macro defines the number of iterations to be expanded
  1622. automatically when processing % rule definitions of the form:
  1623. .sp
  1624. % : %.suff
  1625. .sp
  1626. See the sections on PERCENT(%) RULES for details on how PREP is used.
  1627. .IP \fBSHELL\fP 1.6i
  1628. This macro defines the full path to the executable
  1629. image to be used as the shell when
  1630. processing single line recipes.  This macro must be defined if recipes
  1631. requiring the shell for execution are to be used.
  1632. It is assigned a default value in the startup makefile.
  1633. Under UNIX this value is /bin/sh.
  1634. .IP \fBSHELLFLAGS\fP 1.6i
  1635. This macro gives the set of flags to pass to the shell when
  1636. invoking it to execute a single line recipe.  The value of the macro is the
  1637. list of flags with a leading switch indicator.  (ie. `\-' under UNIX)
  1638. .IP \fBSHELLMETAS\fP 1.6i
  1639. Each time
  1640. .B dmake
  1641. executes a single recipe line (not a group recipe) the line is
  1642. searched for any occurrence of a character defined in the value of SHELLMETAS.
  1643. If such a character is found the recipe line is defined to require a shell
  1644. to ensure its correct execution.  In such instances
  1645. a shell is used to invoke the recipe line.
  1646. If no match is found the recipe line is executed without the use of a shell.
  1647. .sp
  1648. .PP
  1649. There is only one character valued macro defined by \fBdmake\fP:
  1650. \fBSWITCHAR\fP contains the switch character used
  1651. to introduce options on command lines.  For UNIX its value is `\-', and for
  1652. MSDOS its value may be `/' or `\-'.
  1653. The macro is internally defined and is not user setable.
  1654. The MSDOS version of \fBdmake\fP attempts to first extract SWITCHAR from an
  1655. environment variable of the same name.  If that fails it then attempts to
  1656. use the undocumented getswitchar system call, and returns the result of
  1657. that.  Under MSDOS version 4.0 you must set the value of the environment
  1658. macro SWITCHAR to '/' to obtain predictable behavior.
  1659. .PP
  1660. All boolean macros currently understood by 
  1661. .B dmake
  1662. correspond directly to the previously defined attributes.
  1663. These macros provide
  1664. a second way to apply global attributes, and represent the
  1665. preferred method of doing so.  They are used by assigning them a
  1666. value.  If the value is not a NULL string then the boolean condition
  1667. is set to on.
  1668. If the value is a NULL string then the condition is set to off.
  1669. There are five conditions defined and they correspond directly to the
  1670. attributes of the same name.  Their meanings are defined in the ATTRIBUTES
  1671. section above.
  1672. The macros are:
  1673. \&\fB.EPILOG\fP,
  1674. \&\fB.IGNORE\fP,
  1675. \&\fB.MKSARGS\fP,
  1676. \&\fB.NOINFER\fP,
  1677. \&\fB.PRECIOUS\fP,
  1678. \&\fB.PROLOG\fP,
  1679. \&\fB.SEQUENTIAL\fP,
  1680. \&\fB.SILENT\fP,
  1681. \&\fB.SWAP\fP, and
  1682. \&\fB.USESHELL\fP.
  1683. Assigning any of these a non NULL value will globally set
  1684. the corresponding attribute to on.
  1685. .SH "RUN_TIME MACROS"
  1686. These macros are defined
  1687. when \fBdmake\fP is making targets, and may take on different values for each
  1688. target.  \fB$@\fP is defined to be the full target name, \fB$?\fP is the
  1689. list of all out of date prerequisites, \fB$&\fP is the list of all
  1690. prerequisites, \fB$>\fP is the name of the library if the current target is a
  1691. library member, and
  1692. \fB$<\fP is the list of prerequisites specified in the current rule.
  1693. If the current target had a recipe inferred then \fB$<\fP is the name of the
  1694. inferred prerequisite even if the target had a list of prerequisites supplied
  1695. using an explicit rule that did not provide a recipe.  In such situations
  1696. \fB$&\fP gives the full list of prerequisites.
  1697. .PP
  1698. \fB$*\fP is defined as
  1699. \fB$(@:db)\fP when making targets with explicit recipes and is defined as the
  1700. value of % when making targets whose recipe is the result of an inference.
  1701. In the first case \fB$*\fP is the target name with no suffix,
  1702. and in the second case, is the value of the matched % pattern from
  1703. the associated %-rule.
  1704. \fB$^\fP expands to the set of out of date prerequisites taken from the
  1705. current value of \fB$<\fP.
  1706. In addition to these,
  1707. \fB$$\fP expands to $, \fB{{\fP expands to {, \fB}}\fP expands to }, and the
  1708. strings \fB<+\fP and \fB+>\fP are recognized
  1709. as respectively starting and terminating a text diversion when they appear
  1710. literally together in the same input line.
  1711. .PP
  1712. The difference between $? and $^ can best be illustrated by an example,
  1713. consider:
  1714. .RS
  1715. .sp
  1716. .nf
  1717. fred.out : joe amy hello
  1718. \trules for making fred
  1719.  
  1720. fred.out : my.c your.h his.h her.h      # more prerequisites
  1721. .fi
  1722. .sp
  1723. .RE
  1724. Assume joe, amy, and my.c are newer then fred.out.  When
  1725. .B dmake
  1726. executes the recipe for making fred.out the values of the following macros
  1727. will be:
  1728. .RS
  1729. .sp
  1730. .nf
  1731. .Is "$@ "
  1732. .Ii "$@"
  1733. --> fred.out
  1734. .Ii "$*"
  1735. --> fred
  1736. .Ii "$?"
  1737. --> joe amy my.c  # note the difference between $? and $^
  1738. .Ii "$^"
  1739. --> joe amy
  1740. .Ii "$<"
  1741. --> joe amy hello
  1742. .Ii "$&"
  1743. --> joe amy hello my.c your.h his.h her.h
  1744. .fi
  1745. .sp
  1746. .RE
  1747. .SH "FUNCTION MACROS"
  1748. .B dmake
  1749. supports a full set of functional macros.  One of these, the $(mktmp ...)
  1750. macro, is discussed in detail in the TEXT DIVERSION section and is not
  1751. covered here.
  1752. .RS
  1753. .sp
  1754. .IP "$(\fBassign\fP \fBexpression\fP)"
  1755. Causes \fIexpression\fP to be parsed as a macro assignment expression and results
  1756. in the specified assignment being made.  An error is issued if the assignment
  1757. is not syntatically correct.  \fIexpression\fP may contain white space.  This is
  1758. in effect a dynamic macro assignment facility and may appear anywhere any
  1759. other macro may appear.  The result of the expanding a dynamic macro
  1760. assignment expression is the name of the macro that was assigned and $(NULL)
  1761. if the \fIexpression\fP is not a valid macro assignment expression.
  1762. Some examples are:
  1763. .sp
  1764. .nf
  1765. $(assign foo := fred)
  1766. $(assign $(indirect_macro_name) +:= $(morejunk))
  1767. .fi
  1768. .IP "$(\fBnull\fP,\fItext\fP \fBtrue\fP \fBfalse\fP)"
  1769. expands the value of
  1770. .I text.
  1771. If it is NULL then the macro returns the value of the expansion of \fBtrue\fP
  1772. and the expansion of \fBfalse\fP otherwise.  The terms \fBtrue\fP, and
  1773. \fBfalse\fP must be strings containing no white\-space.
  1774. .IP "$(\fB!null\fP,\fItext\fP \fBtrue\fP \fBfalse\fP)"
  1775. Behaves identically to the previous macro except that the 
  1776. .B true
  1777. string is chosen if the expansion of
  1778. .I text
  1779. is not NULL.
  1780. .IP "$(\fBeq\fP,\fItext_a\fP,\fItext_b\fP \fBtrue\fP \fBfalse\fP)"
  1781. expands
  1782. .I text_a
  1783. and
  1784. .I text_b
  1785. and compares their results.  If equal it returns the result of the expansion
  1786. of the 
  1787. .B true
  1788. term, otherwise it returns the expansion of the
  1789. .B false
  1790. term.
  1791. .IP "$(\fB!eq\fP,\fItext_a\fP,\fItext_b\fP \fBtrue\fP \fBfalse\fP)"
  1792. Behaves identically to the previous macro except that the 
  1793. .B true
  1794. string is chosen if the expansions of the two strings are not equal
  1795. .IP "$(\fBnil\fP \fBexpression\fP)"
  1796. Always returns the value of $(NULL) regardless of what \fIexpression\fP is.
  1797. This function macro can be used to discard results of expanding
  1798. macro expressions.
  1799. .IP "$(\fBshell\fP \fBcommand\fP)"
  1800. Runs \fIcommand\fP as if it were part of a recipe and returns,
  1801. separated by a single space, all the non-white
  1802. space terms written to stdout by the command.
  1803. For example:
  1804. .RS
  1805. .RS
  1806. .sp
  1807. $(shell ls *.c)
  1808. .sp
  1809. .RE
  1810. will return \fI"a.c b.c c.c d.c"\fP if the files exist in the current
  1811. directory.  The recipe modification flags \fB[+@%\-]\fP are honored if they
  1812. appear as the first characters in the command.  For example:
  1813. .RS
  1814. .sp
  1815. $(shell +ls *.c)
  1816. .sp
  1817. .RE
  1818. will run the command using the current shell.
  1819. .RE
  1820. .IP "$(\fBshell,expand\fP \fBcommand\fP)"
  1821. Is an extension to the \fB$(shell...\fP function macro that expands the result
  1822. of running \fBcommand\fP.
  1823. .IP "$(\fBsort\fP \fBlist\fP)"
  1824. Will take all white\-space separated tokens in \fIlist\fP and will
  1825. return their sorted equivalent list.
  1826. .IP "$(\fBstrip\fP \fBdata\fP)"
  1827. Will replace all strings of white\-space in data by a single space.
  1828. .IP "$(\fBsubst\fP,\fIpat\fP,\fIreplacement\fP \fBdata\fP)"
  1829. Will search for \fIpat\fP in
  1830. .B data
  1831. and will replace any occurrence of
  1832. .I pat
  1833. with the
  1834. .I replacement
  1835. string.  The expansion
  1836. .RS
  1837. .sp
  1838. $(subst,.o,.c $(OBJECTS))
  1839. .sp
  1840. .RE
  1841. is equivalent to:
  1842. .RS
  1843. .sp
  1844. $(OBJECTS:s/.o/.c/)
  1845. .sp
  1846. .RE
  1847. .RE
  1848. .SH "CONDITIONAL MACROS"
  1849. .B dmake
  1850. supports conditional macros.  These allow the definition of target specific
  1851. macro values.  You can now say the following:
  1852. .RS
  1853. .sp
  1854. \fBtarget\fP ?= \fIMacroName MacroOp Value\fP
  1855. .sp
  1856. .RE
  1857. This creates a definition for \fIMacroName\fP whose value is \fIValue\fP
  1858. only when \fBtarget\fP is being made.  You may use a conditional macro
  1859. assignment anywhere that a regular macro assignment may appear, including
  1860. as the value of a $(assign ...) macro.
  1861. .LP
  1862. The new definition is associated with the most recent cell definition
  1863. for \fBtarget\fP.  If no prior definition exists then one is created.  The
  1864. implications of this are immediately evident in the following example:
  1865. .sp
  1866. .RS
  1867. .nf
  1868. foo := hello
  1869. .sp
  1870. all : cond;@echo "all done, foo=[$(foo)] bar=[$(bar)]"
  1871. .sp
  1872. cond ?= bar := global decl
  1873. .sp
  1874. cond .SETDIR=unix::;@echo $(foo) $(bar)
  1875. cond ?= foo := hi
  1876. .sp
  1877. cond .SETDIR=msdos::;@echo $(foo) $(bar)
  1878.     cond ?= foo := hihi
  1879. .fi
  1880. .RE
  1881. .sp
  1882. The first conditional assignment creates a binding for 'bar' that is
  1883. activated when 'cond' is made.  The bindings following the :: definitions are
  1884. activated when their respective recipe rules are used.  Thus the
  1885. first binding serves to provide a global value for 'bar' while any of the
  1886. cond :: rules are processed, and the local bindings for 'foo' come into
  1887. effect when their associated :: rule is processed.
  1888. .LP
  1889. Conditionals for targets of .UPDATEALL are all activated before the
  1890. target group is made.  Assignments are processed in order.  Note that
  1891. the value of a conditional macro assignment is NOT AVAILABLE until the
  1892. associated target is made, thus the construct
  1893. .sp
  1894. .RS
  1895. .nf
  1896. mytarget ?= bar := hello
  1897. mytarget ?= foo := $(bar)
  1898. .fi
  1899. .RE
  1900. .sp
  1901. results in $(foo) expanding to "", if you want the result to be "hello"
  1902. you must use:
  1903. .sp
  1904. .RS
  1905. .nf
  1906. mytarget ?= bar := hello
  1907. mytarget ?= foo  = $(bar)
  1908. .fi
  1909. .RE
  1910. .sp
  1911. Once a target is made any associated conditional macros are deactivated
  1912. and their values are no longer available.  Activation occurrs after all
  1913. inference, and .SETDIR directives have been processed and after $@ is
  1914. assigned, but before prerequisites are processed; thereby making the values of
  1915. conditional macro definitions available during construction of prerequisites.
  1916. .LP
  1917. If a %-meta rule target has associated conditional macro assignments,
  1918. and the rule is chosen by the inference algorithm then the conditional
  1919. macro assignments are inferred together with the associated recipe.
  1920. .SH "DYNAMIC PREREQUISITES"
  1921. .B dmake
  1922. looks for prerequisites whose names contain macro expansions during target
  1923. processing.  Any such prerequisites are expanded and the result of the
  1924. expansion is used as the prerequisite name.  As an example the line:
  1925. .sp
  1926. \tfred : $$@.c
  1927. .sp
  1928. causes the $$@ to be expanded when \fBdmake\fP is making fred, and it resolves
  1929. to the target \fIfred\fP.
  1930. This enables dynamic prerequisites to be generated.  The value
  1931. of @ may be modified by any of the valid macro modifiers.  So you can say for
  1932. example:
  1933. .sp
  1934. \tfred.out : $$(@:b).c
  1935. .sp
  1936. where the $$(@:b) expands to \fIfred\fP.
  1937. Note the use of $$ instead of $ to indicate the dynamic expansion, this
  1938. is due to the fact that the rule line is expanded when it is initially parsed,
  1939. and $$ then returns $ which later triggers the dynamic prerequisite expansion.
  1940. If you really want a $ to be part of a prerequisite name you must use $$$$.
  1941. Dynamic macro expansion is performed in all user defined rules,
  1942. and the special targets .SOURCE*, and .INCLUDEDIRS.
  1943. .PP
  1944. If dynamic macro expansion results in multiple white space separated tokens
  1945. then these are inserted into the prerequisite list inplace of the dynamic
  1946. prerequisite.  If the new list contains additional dynamic prerequisites they
  1947. will be expanded when they are processed.  The level of recursion in this
  1948. expansion is controlled by the value of the variable \fBDYNAMICNESTINGLEVEL\fP
  1949. and is set to 100 by default.
  1950. .SH "BINDING TARGETS"
  1951. This operation takes a target name and binds it to an existing file, if
  1952. possible.
  1953. .B dmake
  1954. makes a distinction between the internal target name of a target and its
  1955. associated external file name.
  1956. Thus it is possible for a target's internal name and its external
  1957. file name to differ.
  1958. To perform the binding, the following set of rules is used.
  1959. Assume that we are
  1960. trying to bind a target whose name is of the form \fIX.suff\fP,
  1961. where \fI.suff\fP is the suffix and \fIX\fP is the stem portion
  1962. (ie. that part which contains the directory and the basename).
  1963. .B dmake
  1964. takes this target name and performs a series of search operations that try to
  1965. find a suitably named file in the external file system.
  1966. The search operation is user controlled
  1967. via the settings of the various .SOURCE targets.
  1968. .RS
  1969. .IP 1.
  1970. If target has the .SYMBOL attribute set then look for it in the library.
  1971. If found, replace the target name with the library member name and continue
  1972. with step 2.  If the name is not found then return.
  1973. .IP 2.
  1974. Extract the suffix portion (that following the `.') of the target name.
  1975. If the suffix is not null, look up the special target .SOURCE.<suff>
  1976. (<suff> is the suffix).  
  1977. If the special target exists then search each directory given in
  1978. the .SOURCE.<suff> prerequisite list for the target.
  1979. If the target's suffix was null (ie. \fI.suff\fP was empty) then 
  1980. perform the above search but use the special target .SOURCE.NULL instead.
  1981. If at any point a match is found then terminate the search.
  1982. If a directory in the prerequisite list is the special name `.NULL ' perform
  1983. a search for the full target name without prepending any directory portion
  1984. (ie. prepend the NULL directory).
  1985. .IP 3.
  1986. The search in step 2. failed.  Repeat the same search but this time
  1987. use the special target .SOURCE.
  1988. (a default target of '.SOURCE : .NULL' is defined by \fBdmake\fP at startup,
  1989. and is user redefinable)
  1990. .IP 4.
  1991. The search in step 3. failed.
  1992. If the target has the library member attribute (.LIBMEMBER)
  1993. set then try to find the target in the library which was passed along
  1994. with the .LIBMEMBER attribute (see the MAKING LIBRARIES section).
  1995. The bound file name assigned to a target which is successfully
  1996. located in a library is the same name that would be assigned had the search
  1997. failed (see 5.).
  1998. .IP 5.
  1999. The search failed.  Either the target was not found in any of the search
  2000. directories or no applicable .SOURCE special targets exist.
  2001. If applicable .SOURCE special targets exist, but the target was not found,
  2002. then \fBdmake\fP assigns the first name searched as the bound file name.
  2003. If no applicable .SOURCE special targets exist,
  2004. then the full original target name becomes the bound file name.
  2005. .RE
  2006. .PP
  2007. There is potential here for a lot of search operations.  The trick is to
  2008. define .SOURCE.x special targets with short search lists and leave .SOURCE
  2009. as short as possible.
  2010. The search algorithm has the following useful side effect.
  2011. When a target having the .LIBMEMBER (library member) attribute is searched for,
  2012. it is first searched for as an ordinary file.
  2013. When a number of library members require updating it is desirable to compile
  2014. all of them first and to update the library at the end in a single operation.
  2015. If one of the members does not compile and \fBdmake\fP stops, then
  2016. the user may fix the error and make again.  \fBdmake\fP will not remake any
  2017. of the targets whose object files have already been generated as long as
  2018. none of their prerequisite files have been modified as a result of the fix.
  2019. .PP
  2020. When \fBdmake\fP constructs target pathnames './' substrings are removed and
  2021. substrings of the form 'foo/..' are eliminated.  This may result in somewhat
  2022. unexpected values of the macro expansion \fB$@\fP, but is infact the corect
  2023. result.
  2024. .PP
  2025. When defining .SOURCE and .SOURCE.x targets the construct
  2026. .sp
  2027. \t.SOURCE :
  2028. .br
  2029. \t.SOURCE : fred gery
  2030. .sp
  2031. is equivalent to
  2032. .sp
  2033. \t.SOURCE :\- fred gery
  2034. .PP
  2035. \fBdmake\fP correctly handles the UNIX Make variable VPATH.  By definition VPATH
  2036. contains a list of ':' separated directories to search when looking for a
  2037. target.  \fBdmake\fP maps VPATH to the following special rule:
  2038. .sp
  2039. \t.SOURCE :^ $(VPATH:s/:/ /)
  2040. .sp
  2041. Which takes the value of VPATH and sets .SOURCE to the same set of directories
  2042. as specified in VPATH.
  2043. .SH "PERCENT(%) RULES AND MAKING INFERENCES"
  2044. When \fBdmake\fP makes a target, the target's set of prerequisites (if any)
  2045. must exist and the target must have a recipe which \fBdmake\fP
  2046. can use to make it.
  2047. If the makefile does not specify an explicit recipe for the target then
  2048. .B dmake
  2049. uses special rules to try to infer a recipe which it can use
  2050. to make the target.  Previous versions of Make perform this task by using
  2051. rules that are defined by targets of the form .<suffix>.<suffix> and by
  2052. using the .SUFFIXES list of suffixes.  The exact workings of this mechanism
  2053. were sometimes difficult to understand and often limiting in their usefulness.
  2054. Instead, \fBdmake\fP supports the concept of \fI%-meta\fP rules.  
  2055. The syntax and semantics of these rules differ from standard rule lines as
  2056. follows:
  2057. .sp
  2058. .nf
  2059. .RS
  2060. \fI<%-target>\fP [\fI<attributes>\fP] \fI<ruleop>\fP [\fI<%-prerequisites>\fP] [;\fI<recipe>\fP]
  2061. .RE
  2062. .fi
  2063. .sp
  2064. where \fI%-target\fP is a target containing exactly a single `%' sign,
  2065. .I attributes
  2066. is a list (possibly empty) of attributes,
  2067. .I ruleop
  2068. is the standard set of rule operators,
  2069. .I "%-prerequisites"
  2070. \&, if present, is a list of prerequisites containing zero or more `%' signs,
  2071. and
  2072. .I recipe,
  2073. if present, is the first line of the recipe.
  2074. .PP
  2075. The
  2076. .I %-target
  2077. defines a pattern against which a target whose recipe is
  2078. being inferred gets matched.  The pattern match goes as follows:  all chars are
  2079. matched exactly from left to right up to but not including the % sign in the
  2080. pattern, % then matches the longest string from the actual target name
  2081. not ending in
  2082. the suffix given after the % sign in the pattern.
  2083. Consider the following examples:
  2084. .RS
  2085. .sp
  2086. .nf
  2087. .Is "dir/%.c   "
  2088. .Ii "%.c"
  2089. matches fred.c but not joe.c.Z
  2090. .Ii "dir/%.c"
  2091. matches dir/fred.c but not dd/fred.c
  2092. .Ii "fred/%"
  2093. matches fred/joe.c but not f/joe.c
  2094. .Ii "%"
  2095. matches anything
  2096. .fi
  2097. .sp
  2098. .RE
  2099. In each case the part of the target name that matched the % sign is retained
  2100. and is substituted for any % signs in the prerequisite list of the %-meta rule
  2101. when the rule is selected during inference and
  2102. .B dmake
  2103. constructs the new dependency.
  2104. As an example the following %-meta rules describe the following:
  2105. .RS
  2106. .sp
  2107. %.c : %.y ; recipe...
  2108. .sp
  2109. .RE
  2110. describes how to make any file ending in .c if a corresponding file ending
  2111. in .y can be found.
  2112. .RS
  2113. .sp
  2114. foo%.o : fee%.k ; recipe...
  2115. .sp
  2116. .RE
  2117. is used to describe how to make fooxxxx.o from feexxxx.k.
  2118. .RS
  2119. .sp
  2120. %.a :; recipe...
  2121. .sp
  2122. .RE
  2123. describes how to make a file whose suffix is .a without inferring any
  2124. prerequisites.
  2125. .RS
  2126. .sp
  2127. %.c : %.y yaccsrc/%.y ; recipe...
  2128. .sp
  2129. .RE
  2130. is a short form for the construct:
  2131. .RS
  2132. .sp
  2133. %.c : %.y ; recipe...
  2134. .br
  2135. %.c : yaccsrc/%.y ; recipe...
  2136. .sp
  2137. .RE
  2138. ie. It is possible to specify the same recipe for two %-rules by giving
  2139. more than one prerequisite in the prerequisite list.
  2140. A more interesting example is:
  2141. .RS
  2142. .sp
  2143. % : RCS/%,v ; co $<
  2144. .sp
  2145. .RE
  2146. which describes how to take any target and check it out of
  2147. the RCS directory if the corresponding file exists in the RCS directory.
  2148. The equivalent SCCS rule would be:
  2149. .RS
  2150. .sp
  2151. % : s.% ; get $<
  2152. .sp
  2153. .RE
  2154. .PP
  2155. The previous RCS example defines an infinite rule, because it says how to make
  2156. .I anything
  2157. from RCS/%,v, and
  2158. .I anything
  2159. also includes RCS/fred.c,v.
  2160. To limit the size of the graph that results from such rules
  2161. .B dmake
  2162. uses the macro variable PREP (stands for % repetition).  By default the value
  2163. of this variable is 0, which says that no repetitions of a %-rule are to be
  2164. generated.  If it is set to something greater than 0, then that many
  2165. repetitions of any infinite %-rule are allowed.  If in the above
  2166. example PREP was set to 1, then \fBdmake\fP would generate the dependency
  2167. graph:
  2168. .RS
  2169. .sp
  2170. % --> RCS/%,v --> RCS/RCS/%,v,v
  2171. .sp
  2172. .RE
  2173. Where each link is assigned the same recipe as the first link.
  2174. PREP should be used only in special cases, since it may result in
  2175. a large increase in the number of possible prerequisites tested.
  2176. .B dmake
  2177. further assumes that any target that has no suffix can be made from
  2178. a prerequisite that has at least one suffix.
  2179. .PP
  2180. .B dmake
  2181. supports dynamic prerequisite generation for prerequisites of %-meta rules.
  2182. This is best illustrated by an example.  The RCS rule shown above can infer
  2183. how to check out a file from a corresponding RCS file only if the target
  2184. is a simple file name with no directory information.  That is, the above rule
  2185. can infer how to find \fIRCS/fred.c,v\fP from the target \fIfred.c\fP,
  2186. but cannot infer how to find \fIsrcdir/RCS/fred.c,v\fP from \fIsrcdir/fred.c\fP
  2187. because the above rule will cause \fBdmake\fP to look for RCS/srcdir/fred.c,v;
  2188. which does not exist (assume that srcdir has its own RCS directory as is the
  2189. common case).
  2190. .PP
  2191. A more versatile formulation of the above RCS check out rule is the following:
  2192. .RS
  2193. .sp
  2194. % :  $$(@:d)RCS/$$(@:f),v : co $@
  2195. .sp
  2196. .RE
  2197. This rule uses the dynamic macro $@ to specify the prerequisite to try to
  2198. infer.  During inference of this rule the macro $@ is set to the value of
  2199. the target of the %-meta rule and the appropriate prerequisite is generated by
  2200. extracting the directory portion of the target name (if any), appending the
  2201. string \fIRCS/\fP to it, and appending the target file name with a trailing
  2202. \fI,v\fP attached to the previous result.
  2203. .PP
  2204. .B dmake
  2205. can also infer indirect prerequisites.
  2206. An inferred target can have a list of prerequisites added that will not
  2207. show up in the value of $< but will show up in the value of $? and $&.
  2208. Indirect prerequisites are specified in an inference rule by quoting the
  2209. prerequisite with single quotes.  For example, if you had the explicit
  2210. dependency:
  2211. .RS
  2212. .sp
  2213. .nf
  2214. fred.o : fred.c ; rule to make fred.o
  2215. fred.o : local.h
  2216. .fi
  2217. .sp
  2218. .RE
  2219. then this can be inferred for fred.o from the following inference rule:
  2220. .RS
  2221. .sp
  2222. %.o : %.c 'local.h' ; rule to make a .o from a .c
  2223. .sp
  2224. .RE
  2225. You may infer indirect prerequisites that are a function of the value of '%'
  2226. in the current rule.  The meta-rule:
  2227. .RS
  2228. .sp
  2229. %.o : %.c '$(INC)/%.h' ; rule to make a .o from a .c
  2230. .sp
  2231. .RE
  2232. infers an indirect prerequisite found in the INC directory whose name is the
  2233. same as the expansion of $(INC), and the prerequisite name depends on the
  2234. base name of the current target.
  2235. The set of indirect prerequisites is attached to the meta rule in which they
  2236. are specified and are inferred only if the rule is used to infer a recipe
  2237. for a target.  They do not play an active role in driving the inference
  2238. algorithm.
  2239. The construct:
  2240. .RS
  2241. .sp
  2242. %.o : %.c %.f 'local.h'; recipe
  2243. .sp
  2244. .RE
  2245. is equivalent to:
  2246. .RS
  2247. .sp
  2248. .nf
  2249. %.o : %.c 'local.h' : recipe
  2250. .fi
  2251. .sp
  2252. .RE
  2253. while:
  2254. .RS
  2255. .sp
  2256. %.o :| %.c %.f 'local.h'; recipe
  2257. .sp
  2258. .RE
  2259. is equivalent to:
  2260. .RS
  2261. .sp
  2262. .nf
  2263. %.o : %.c 'local.h' : recipe
  2264. %.o : %.f 'local.h' : recipe
  2265. .fi
  2266. .sp
  2267. .RE
  2268. .PP
  2269. If any of the attributes .SETDIR, .EPILOG, .PROLOG, .SILENT,
  2270. \&.USESHELL, .SWAP, .PRECIOUS, .LIBRARY, .NOSTATE and .IGNORE
  2271. are given for a %-rule then when that rule is bound to a target
  2272. as the result of an inference, the target's set of attributes is augmented by
  2273. the attributes from the above set that are specified in the bound %-rule.
  2274. Other attributes specified for %-meta rules are not inherited by the target.
  2275. The .SETDIR attribute is treated in a special way.
  2276. If the target already had a .SETDIR attribute set then
  2277. .B dmake
  2278. changes to that directory prior to performing the inference.
  2279. During inference any .SETDIR attributes for the inferred prerequisite
  2280. are honored.
  2281. The directories must exist for a %-meta rule to be selected as a possible
  2282. inference path.  If the directories do not exist no error message is issued,
  2283. instead the corresponding path in the inference graph is rejected.
  2284. .PP
  2285. .B dmake
  2286. also supports the old format special target .<suffix>.<suffix>
  2287. by identifying any rules
  2288. of this form and mapping them to the appropriate %-rule.  So for example if
  2289. an old makefile contains the construct:
  2290. .RS
  2291. .sp
  2292. \&.c.o :; cc \-c $< \-o $@
  2293. .sp
  2294. .RE
  2295. .B dmake
  2296. maps this into the following %-rule:
  2297. .RS
  2298. .sp
  2299. %.o : %.c; cc \-c $< \-o $@
  2300. .sp
  2301. .RE
  2302. Furthermore,
  2303. .B dmake
  2304. understands several SYSV AUGMAKE special targets and maps them into
  2305. corresponding %-meta rules.  These transformation must be enabled by providing
  2306. the \-A flag on the command line or by setting the value of AUGMAKE to
  2307. non\-NULL.
  2308. The construct
  2309. .RS
  2310. .sp
  2311. \&.suff :; recipe
  2312. .sp
  2313. .RE
  2314. gets mapped into:
  2315. .RS
  2316. .sp
  2317. % : %.suff; recipe
  2318. .sp
  2319. .RE
  2320. and the construct
  2321. .RS
  2322. .sp
  2323. \&.c~.o :; recipe
  2324. .sp
  2325. .RE
  2326. gets mapped into:
  2327. .RS
  2328. .sp
  2329. %.o : s.%.c ; recipe
  2330. .sp
  2331. .RE
  2332. In general, a special target of the form .<str>~ is replaced by the %-rule
  2333. construct s.%.<str>, thereby providing support for the syntax used by SYSV
  2334. AUGMAKE for providing SCCS support.
  2335. When enabled, these mappings allow processing of existing SYSV
  2336. makefiles without modifications.
  2337. .PP
  2338. .B dmake
  2339. bases all of its inferences on the inference graph constructed from the
  2340. %-rules defined in the makefile.
  2341. It knows exactly which targets can be made from which prerequisites by
  2342. making queries on the inference graph.  For this reason .SUFFIXES is not
  2343. needed and is completely ignored.
  2344. .PP
  2345. For a %-meta rule to be inferred as the
  2346. rule whose recipe will be used to make a target, the target's name must match
  2347. the %-target pattern, and any inferred %-prerequisite must already exist or
  2348. have an explicit recipe so that the prerequisite can be made.
  2349. Without \fItransitive closure\fP on the inference graph the above rule
  2350. describes precisely when an inference match terminates the search.
  2351. If transitive closure is enabled (the usual case), and a prerequisite does
  2352. not exist or cannot be made, then
  2353. .B dmake
  2354. invokes the inference algorithm recursively on the prerequisite to see if
  2355. there is some way the prerequisite can be manufactured.  For, if the
  2356. prerequisite can be made then the current target can also be made using the
  2357. current %-meta rule.
  2358. This means that there is no longer a need to give a rule
  2359. for making a .o from a .y if you have already given a rule for making a .o
  2360. from a .c and a .c from a .y.  In such cases
  2361. .B dmake
  2362. can infer how to make the
  2363. \&.o from the .y via the intermediary .c and will remove the .c when the .o is
  2364. made.  Transitive closure can be disabled by giving the \-T switch on the
  2365. command line.
  2366. .PP
  2367. A word of caution.
  2368. .B dmake
  2369. bases its transitive closure on the %-meta rule targets.
  2370. When it performs transitive closure it infers how to make a target from a
  2371. prerequisite by performing a pattern match as if the potential prerequisite
  2372. were a new target.
  2373. The set of rules:
  2374. .RS
  2375. .nf
  2376. .sp
  2377. %.o : %.c :; rule for making .o from .c
  2378. %.c : %.y :; rule for making .c from .y
  2379. % : RCS/%,v :; check out of RCS file
  2380. .fi
  2381. .sp
  2382. .RE
  2383. will, by performing transitive closure, allow \fBdmake\fP to infer how to make
  2384. a .o from a .y using a .c as an intermediate temporary file.  Additionally
  2385. it will be able to infer how to make a .y from an RCS file, as long as that
  2386. RCS file is in the RCS directory and has a name which ends in .y,v.
  2387. The transitivity computation is performed dynamically for each target that
  2388. does not have a recipe.  This has potential to be costly if the %-meta
  2389. rules are not carefully specified.  The .NOINFER attribute is used to mark
  2390. a %-meta node as being a final target during inference.  Any node with this
  2391. attribute set will not be used for subsequent inferences.  As an example
  2392. the node RCS/%,v is marked as a final node since we know that if the RCS file
  2393. does not exist there likely is no other way to make it.  Thus the standard
  2394. startup makefile contains an entry similar to:
  2395. .RS
  2396. .nf
  2397. \&.NOINFER : RCS/%,v
  2398. .fi
  2399. .RE
  2400. Thereby indicating that the RCS file is the end of the inference chain.
  2401. Whenever the inference algorithm determines that a target can be made from
  2402. more than one prerequisite and the inference chains for the two methods
  2403. are the same length the algorithm reports an ambiguity and prints the
  2404. ambiguous inference chains.
  2405. .PP
  2406. .B dmake
  2407. tries to
  2408. remove intermediate files resulting from transitive closure if the file
  2409. is not marked as being PRECIOUS, or the \fB\-u\fP flag was not given on the
  2410. command line, and if the inferred intermediate did not previously exist.
  2411. Intermediate targets that existed prior to being made are never removed.
  2412. This is in keeping with the philosophy that
  2413. .B dmake
  2414. should never remove things from the file system that it did not add.
  2415. If the special target .REMOVE is defined and has a recipe then
  2416. .B dmake
  2417. constructs a list of the intermediate files to be removed and makes them
  2418. prerequisites of .REMOVE.  It then makes .REMOVE thereby removing the
  2419. prerequisites if the recipe of .REMOVE says to.  Typically .REMOVE is defined
  2420. in the startup file as:
  2421. .sp
  2422. \t.REMOVE :; $(RM) $<
  2423. .SH "MAKING TARGETS"
  2424. In order to update a target \fBdmake\fP must execute a recipe.
  2425. When a recipe needs to be executed it is first expanded so that any macros
  2426. in the recipe text are expanded, and it is then either executed directly or
  2427. passed to a shell.
  2428. .B dmake
  2429. supports two types of recipes.  The regular recipes and group recipes.
  2430. .PP
  2431. When a regular recipe is invoked \fBdmake\fP executes each line of the recipe
  2432. separately using a new copy of a shell if a shell is required.
  2433. Thus effects of commands do not generally persist across recipe lines
  2434. (e.g. cd requests in a recipe line do not carry over to the next recipe line).
  2435. This is true even in environments such as \fBMSDOS\fP, where dmake internally
  2436. sets the current working director to match the directory it was in before
  2437. the command was executed.
  2438. .PP
  2439. The decision on whether a shell is required to execute a command is based on
  2440. the value of the macro SHELLMETAS or on the specification of '+' or .USESHELL
  2441. for the current recipe or target respectively.
  2442. If any character in the value of
  2443. SHELLMETAS is found in the expanded recipe text-line or the use of a shell
  2444. is requested explicitly via '+' or .USESHELL then the command is
  2445. executed using a shell, otherwise the command is executed directly.
  2446. The shell that is used for execution is given by the value of the macro SHELL.
  2447. The flags that are passed to the shell are given by the value of SHELLFLAGS.
  2448. Thus \fBdmake\fP constructs the command line:
  2449. .sp
  2450. \t$(SHELL) $(SHELLFLAGS) $(expanded_recipe_command)
  2451. .sp
  2452. Normally
  2453. .B dmake
  2454. writes the command line that it is about to invoke to standard output.
  2455. If the .SILENT attribute is set for the target or for
  2456. the recipe line (via @), then the recipe line is not echoed.
  2457. .PP
  2458. Group recipe processing is similar to that of regular recipes, except that
  2459. a shell is always invoked.  The shell that is invoked is given by the value of
  2460. the macro GROUPSHELL, and its flags are taken from the value of the macro
  2461. GROUPFLAGS.  If a target has the .PROLOG attribute set then
  2462. .B dmake
  2463. prepends to the shell script the recipe associated with the special target
  2464. \&.GROUPPROLOG, and if the attribute .EPILOG is set as well, then the recipe
  2465. associated with the special target .GROUPEPILOG is appended to the script
  2466. file.
  2467. This facility can be used to always prepend a common header and common trailer
  2468. to group recipes.
  2469. Group recipes are echoed to standard output just like standard recipes, but
  2470. are enclosed by lines beginning with [ and ].
  2471. .PP
  2472. The recipe flags [+,\-,%,@] are recognized at the start of a recipe line
  2473. even if they appear in a macro.  For example:
  2474. .RS
  2475. .sp
  2476. .nf
  2477. SH = +
  2478. all:
  2479. \t$(SH)echo hi
  2480. .fi
  2481. .sp
  2482. .RE
  2483. is completely equivalent to writing
  2484. .RS
  2485. .sp
  2486. .nf
  2487. SH = +
  2488. all:
  2489. \t+echo hi
  2490. .fi
  2491. .sp
  2492. .RE
  2493. .PP
  2494. The last step performed by
  2495. .B dmake
  2496. prior to running a recipe is to set the macro CMNDNAME to the name of the
  2497. command to execute (determined by finding the first white\-space ending token
  2498. in the command line).  It then sets the macro CMNDARGS to be the remainder
  2499. of the line.
  2500. .B dmake
  2501. then expands the macro COMMAND which by default is set to
  2502. .RS
  2503. .sp
  2504. COMMAND = $(CMNDNAME) $(CMNDARGS)
  2505. .sp
  2506. .RE
  2507. The result of this final expansion is the command that will be executed.
  2508. The reason for this expansion is to allow for a different interface to
  2509. the argument passing facilities (esp. under DOS) than that provided by
  2510. .B dmake\fR.\fP
  2511. You can for example define COMMAND to be
  2512. .RS
  2513. .sp
  2514. COMMAND = $(CMNDNAME) @$(mktmp $(CMNDARGS))
  2515. .sp
  2516. .RE
  2517. which dumps the arguments into a temporary file and runs the command
  2518. .RS
  2519. .sp
  2520. $(CMNDNAME) @/tmp/ASAD23043
  2521. .sp
  2522. .RE
  2523. which has a much shorter argument list.  It is now up to the command to
  2524. use the supplied argument as the source for all other arguments.
  2525. As an optimization, if COMMAND is not defined
  2526. .B dmake
  2527. does not perform the above expansion.  On systems, such as UNIX, that
  2528. handle long command lines this provides a slight saving in processing the
  2529. makefiles.
  2530. .SH "MAKING LIBRARIES"
  2531. Libraries are easy to maintain using \fBdmake\fP.  A library is a file
  2532. containing a collection of object files.
  2533. Thus to make a library you simply specify it as a target with the .LIBRARY
  2534. attribute set and specify its list of prerequisites.  The prerequisites should
  2535. be the object members that are to go into the library.  When
  2536. .B dmake
  2537. makes the library target it uses the .LIBRARY attribute to pass to the
  2538. prerequisites the .LIBMEMBER attribute and the name of the library.  This
  2539. enables the file binding mechanism to look for the member in the library if an
  2540. appropriate object file cannot be found. A small example best illustrates
  2541. this.
  2542. .RS
  2543. .nf
  2544. .sp
  2545. mylib.a .LIBRARY : mem1.o mem2.o mem3.o
  2546. \trules for making library...
  2547. \t# remember to remove .o's when lib is made
  2548. .sp
  2549. # equivalent to:  '%.o : %.c ; ...'
  2550. \&.c.o :; rules for making .o from .c say
  2551. .sp
  2552. .fi
  2553. .RE
  2554. .B dmake
  2555. will use the .c.o rule for making the library members if appropriate .c files
  2556. can be found using the search rules.  NOTE:  this is not specific in any way
  2557. to C programs, they are simply used as an example.
  2558. .PP
  2559. .B dmake
  2560. tries to handle the old library construct format in a sensible way.
  2561. The construct 
  2562. .I lib(member.o)
  2563. is separated and the \fIlib\fP portion is declared
  2564. as a library target.
  2565. The new target is defined
  2566. with the .LIBRARY attribute set and the \fImember.o\fP portion of the
  2567. construct is
  2568. declared as a prerequisite of the lib target.
  2569. If the construct \fIlib(member.o)\fP
  2570. appears as a prerequisite of a target in the
  2571. makefile, that target has the new name of the lib assigned as its
  2572. prerequisite.  Thus the following example:
  2573. .RS
  2574. .sp
  2575. .nf
  2576. a.out : ml.a(a.o) ml.a(b.o); $(CC) \-o $@  $<
  2577.  
  2578. \&.c.o :; $(CC) \-c $(CFLAGS) \-o $@  $<
  2579. %.a:
  2580. \tar rv $@ $?
  2581. \tranlib $@
  2582. \trm \-rf $?
  2583. .sp
  2584. .fi
  2585. .RE
  2586. constructs the following dependency
  2587. graph.
  2588. .RS
  2589. .sp
  2590. .nf
  2591. a.out : ml.a; $(CC) \-o $@  $<
  2592. ml.a .LIBRARY : a.o b.o
  2593.  
  2594. %.o : %.c ; $(CC) -c $(CFLAGS) \-o $@  $<
  2595. %.a :
  2596. \tar rv $@ $?
  2597. \tranlib $@
  2598. \trm -rf $?
  2599. .sp
  2600. .fi
  2601. .RE
  2602. and making a.out then works as expected.
  2603. .PP
  2604. The same thing happens for any target of the form \fIlib((entry))\fP.
  2605. These targets have an
  2606. additional feature in that the \fIentry\fP target has the .SYMBOL attribute
  2607. set automatically.
  2608. .PP
  2609. NOTE:  If the notion of entry points is supported by the archive and by
  2610. \fBdmake\fP (currently not the case) then
  2611. .B dmake
  2612. will search the archive for the entry point and return not only the
  2613. modification time of the member which defines the entry but also the name of
  2614. the member file.  This name will then replace \fIentry\fP and will be used for
  2615. making the member file.  Once bound to an archive member the .SYMBOL
  2616. attribute is removed from the target.
  2617. This feature is presently disabled as there is little standardization
  2618. among archive formats, and we have yet to find a makefile utilizing this
  2619. feature (possibly due to the fact that it is unimplemented in most versions
  2620. of UNIX Make).
  2621. .PP
  2622. Finally, when
  2623. .B dmake
  2624. looks for a library member it must first locate the library file.
  2625. It does so by first looking for the library relative to the current directory
  2626. and if it is not found it then looks relative to the current value of
  2627. $(TMD).  This allows commonly used libraries to be kept near the root of
  2628. a source tree and to be easily found by
  2629. .B dmake\fR.\fP
  2630. .SH "KEEP STATE"
  2631. .B dmake
  2632. supports the keeping of state information for targets that it makes whenever
  2633. the macro .KEEP_STATE is assigned a value.  The value of the macro should be
  2634. the name of a state file that will contain the state information.  If state
  2635. keeping is enabled then each target that does not poses the .NOSTATE
  2636. attribute will have a record written into the state file indicating the
  2637. target's name, the current directory, the command used to update the target,
  2638. and which, if any, :: rule is being used.  When you make this target again
  2639. if any of this information does not match the previous settings and the
  2640. target is not out dated it will still be re\-made.  The assumption is that one
  2641. of the conditions above has changed and that we wish to remake the target.
  2642. For example,
  2643. state keeping is used in the maintenance of
  2644. .B dmake
  2645. to test compile different versions of the source using different compilers.
  2646. Changing the compiler causes the compilation flags to be modified and hence
  2647. all sources to be recompiled.
  2648. .PP
  2649. The state file is an ascii file and is portable, however it is
  2650. not in human readable form as the entries represent hash keys of the above
  2651. information.
  2652. .PP
  2653. The Sun Microsystem's Make construct
  2654. .RS
  2655. .sp
  2656. \&.KEEP_STATE :
  2657. .sp
  2658. .RE
  2659. is recognized and is mapped to \fB.KEEP_STATE:=_state.mk\fP.
  2660. The
  2661. .B dmake
  2662. version of state keeping does not include scanning C source files for
  2663. dependencies like Sun Make.  This is specific to C programs and it was
  2664. felt that it does not belong in make.
  2665. .B dmake
  2666. instead provides the tool, \fBcdepend\fP, to scan C source files and to produce
  2667. depedency information.  Users are free to modify cdepend to produce other
  2668. dependency files.  (NOTE:
  2669. .B cdepend
  2670. does not come with the distribution at this time, but will be available in
  2671. a patch in the near future)
  2672. .SH "MULTI PROCESSING"
  2673. If the architecture supports it then \fBdmake\fP is capable of making a target's
  2674. prerequisites in parallel.  \fBdmake\fP will make as much in parallel as it
  2675. can and use a number of child processes up to the maximum specified by
  2676. MAXPROCESS or by the value supplied to the \-P command line flag.
  2677. A parallel make is enabled by setting the value of MAXPROCESS (either directly
  2678. or via \-P option) to a value which is > 1.
  2679. \fBdmake\fP guarantees that all dependencies as specified in the makefile are
  2680. honored.  A target will not be made until all of its prerequisites have been
  2681. made.  Note that when you specify \fB-P 4\fP then four child processes are
  2682. run concurrently but \fBdmake\fP actually displays the fifth command it will
  2683. run immediately upon a child process becomming free.  This is an artifact of
  2684. the method used to traverse the dependency graph and cannot be removed.
  2685. If a parallel make is being performed then the following restrictions on
  2686. parallelism are enforced.
  2687. .RS
  2688. .IP 1.
  2689. Individual recipe lines in a non-group recipe are performed sequentially in
  2690. the order in which they are specified within the makefile and in parallel with
  2691. the recipes of other targets.
  2692. .IP 2.
  2693. If a target contains multiple recipe definitions (cf. :: rules) then these are
  2694. performed sequentially in the order in which the :: rules are specified within
  2695. the makefile and in parallel with the recipes of other targets.
  2696. .IP 3.
  2697. If a target rule contains the `!' modifier, then the recipe is performed
  2698. sequentially for the list of outdated prerequisites and in parallel with the recipes of other targets.
  2699. .IP 4.
  2700. If a target has the .SEQUENTIAL attribute set then all of its prerequisites
  2701. are made sequentially relative to one another (as if MAXPROCESS=1), but in
  2702. parallel with other targets in the makefile.
  2703. .RE
  2704. .PP
  2705. Note:  If you specify a parallel make then
  2706. the order of target update and the order in which the associated recipes are
  2707. invoked will not correspond to that displayed by the \-n flag.
  2708. .SH "CONDITIONALS"
  2709. .B dmake
  2710. supports a makefile construct called a \fIconditional\fR.  It allows
  2711. the user
  2712. to conditionally select portions of makefile text for input processing
  2713. and to discard other portions.  This becomes useful for
  2714. writing makefiles that are intended to function for more than one target
  2715. host and environment.  The conditional expression is specified as follows:
  2716. .sp
  2717. .RS
  2718. .nf
  2719. \&.IF  \fIexpression\fR
  2720.    ... if text ...
  2721. \&.ELIF  \fIexpression\fR
  2722.    ... if text ...
  2723. \&.ELSE
  2724.    ... else text ...
  2725. \&.END
  2726. .RE
  2727. .fi
  2728. .sp
  2729. The .ELSE and .ELIF portions are optional, and the conditionals may be
  2730. nested (ie.  the text may contain another conditional).
  2731. \&.IF, .ELSE, and .END
  2732. may appear anywhere in the makefile, but a single conditional expression
  2733. may not span multiple makefiles.
  2734. .PP
  2735. \fIexpression\fR can be one of the following three forms:
  2736. .sp
  2737. \t<text> | <text> == <text> | <text> != <text>
  2738. .sp
  2739. where \fItext\fR is either text or a macro expression.  In any case,
  2740. before the comparison is made, the expression is expanded.  The text
  2741. portions are then selected and compared.  White space at the start and
  2742. end of the text portion is discarded before the comparison.  This means
  2743. that a macro that evaluates to nothing but white space is considered a
  2744. NULL value for the purpose of the comparison.
  2745. In the first case the expression evaluates TRUE if the text is not NULL
  2746. otherwise it evaluates FALSE.  The remaining two cases both evaluate the
  2747. expression on the basis of a string comparison.
  2748. If a macro expression needs to be equated to a NULL string then compare it to
  2749. the value of the macro $(NULL).
  2750. You can use the $(shell ...) macro to construct more complex test expressions.
  2751. .SH "EXAMPLES"
  2752. .RS
  2753. .nf
  2754. .sp
  2755. # A simple example showing how to use make
  2756. #
  2757. prgm : a.o b.o
  2758.     cc a.o b.o \-o prgm
  2759. a.o : a.c g.h
  2760.     cc a.c \-o $@
  2761. b.o : b.c g.h
  2762.     cc b.c \-o $@
  2763. .fi
  2764. .RE
  2765. .sp
  2766. In the previous
  2767. example prgm is remade only if a.o and/or b.o is out of date with
  2768. respect to prgm.
  2769. These dependencies can be stated more concisely
  2770. by using the inference rules defined in the standard startup file.
  2771. The default rule for making .o's from .c's looks something like this:
  2772. .sp
  2773. \&\t%.o : %.c; cc \-c $(CFLAGS) \-o $@ $<
  2774. .sp
  2775. Since there exists a rule (defined in the startup file)
  2776. for making .o's from .c's
  2777. \fBdmake\fR will use that rule
  2778. for manufacturing a .o from a .c and we can specify our dependencies
  2779. more concisely.
  2780. .sp
  2781. .RS
  2782. .nf
  2783. prgm : a.o b.o
  2784.     cc \-o prgm $<
  2785. a.o b.o : g.h
  2786. .fi
  2787. .RE
  2788. .sp
  2789. A more general way to say the above using the new macro expansions
  2790. would be:
  2791. .sp
  2792. .RS
  2793. .nf
  2794. SRC = a b
  2795. OBJ = {$(SRC)}.o
  2796. .sp
  2797. prgm : $(OBJ)
  2798.     cc \-o $@ $<
  2799. .sp
  2800. $(OBJ) : g.h
  2801. .fi
  2802. .RE
  2803. .sp
  2804. If we want to keep the objects in a separate directory, called
  2805. objdir, then we would write
  2806. something like this.
  2807. .sp
  2808. .RS
  2809. .nf
  2810. SRC = a b
  2811. OBJ = {$(SRC)}.o
  2812. .sp
  2813. prgm : $(OBJ)
  2814.     cc $< \-o $@
  2815. .sp
  2816. $(OBJ) : g.h
  2817. \&%.o : %.c
  2818.     $(CC) \-c $(CFLAGS) \-o $(@:f) $<
  2819.     mv $(@:f) objdir
  2820.  
  2821. \&.SOURCE.o : objdir        # tell make to look here for .o's
  2822. .fi
  2823. .RE
  2824. .sp
  2825. An example of building library members would go something like this:
  2826. (NOTE:  The same rules as above will be used to produce .o's from .c's)
  2827. .sp
  2828. .RS
  2829. .nf
  2830. SRC\t= a b
  2831. LIB\t= lib
  2832. LIBm\t= { $(SRC) }.o
  2833. .sp
  2834. prgm: $(LIB)
  2835.     cc \-o $@ $(LIB)
  2836. .sp
  2837. $(LIB) .LIBRARY : $(LIBm)
  2838.     ar rv $@ $<
  2839.     rm $<
  2840. .fi
  2841. .RE
  2842. .sp
  2843. Finally, suppose that each of the source files in the previous example had
  2844. the `:' character in their target name.  Then we would write the above example
  2845. as:
  2846. .sp
  2847. .RS
  2848. .nf
  2849. SRC\t= f:a f:b
  2850. LIB\t= lib
  2851. LIBm\t= "{ $(SRC) }.o"        # put quotes around each token
  2852. .sp
  2853. prgm: $(LIB)
  2854.     cc \-o $@ $(LIB)
  2855. .sp
  2856. $(LIB) .LIBRARY : $(LIBm)
  2857.     ar rv $@ $<
  2858.     rm $<
  2859. .fi
  2860. .RE
  2861. .SH "COMPATIBILITY"
  2862. There are two notable differences between 
  2863. .B \fBdmake\fR
  2864. and the standard version of BSD UNIX 4.2/4.3 Make.
  2865. .RS
  2866. .IP 1. .3i
  2867. BSD UNIX 4.2/4.3 Make supports wild card filename expansion for
  2868. prerequisite names.  Thus if a directory contains a.h, b.h and c.h, then a
  2869. line like
  2870. .sp
  2871. \ttarget: *.h
  2872. .sp
  2873. will cause UNIX make to expand the *.h into "a.h b.h c.h".  \fBdmake\fR
  2874. does not support this type of filename expansion.
  2875. .IP 2. .3i
  2876. Unlike UNIX make, touching a library member causes \fBdmake\fR
  2877. to search the library for the member name and to update the library time stamp.
  2878. This is only implemented in the UNIX version.
  2879. MSDOS and other versions may not have librarians that keep file time stamps,
  2880. as a result \fBdmake\fR touches the library file itself, and prints a warning.
  2881. .RE
  2882. .PP
  2883. \fBdmake\fP is not compatible with GNU Make.  In particular it does not
  2884. understand GNU Make's macro expansions that query the file system.
  2885. .PP
  2886. .B dmake
  2887. is fully compatible with SYSV AUGMAKE, and supports the following AUGMAKE
  2888. features:
  2889. .RS
  2890. .IP 1. .3i
  2891. The word \fBinclude\fP appearing at the start of a line can be used instead of
  2892. the ".INCLUDE :" construct understood by \fBdmake\fP.
  2893. .IP 2. .3i
  2894. The macro modifier expression $(macro:str=sub) is understood and is equivalent
  2895. to the expression $(macro:s/str/sub), with the restriction that str must match
  2896. the following regular expression:
  2897. .sp
  2898. \tstr[ |\et][ |\et]*
  2899. .sp
  2900. (ie. str only matches at the end of a token where str is a suffix and is
  2901. terminated by a space, a tab, or end of line)
  2902. Normally \fIsub\fP is expanded before the substitution is made, if you specify
  2903. \-A on the command line then sub is not expanded.
  2904. .IP 3.
  2905. The macro % is defined to be $@ (ie. $% expands to the same value as $@).
  2906. .IP 4.
  2907. The AUGMAKE notion of libraries is handled correctly.
  2908. .IP 5.
  2909. When defining special targets for the inference rules and the AUGMAKE special
  2910. target handling is enabled then the special target
  2911. \&.X is equivalent to the %-rule "% : %.X".
  2912. .IP 6.
  2913. Directories are always made if you specify \fB\-A\fP.  This is consistent
  2914. with other UNIX versions of Make.
  2915. .IP 7.
  2916. Makefiles that utilize virtual targets to force making of other targets work
  2917. as expected if AUGMAKE special target handling is enabled.  For example:
  2918. .sp
  2919. .nf
  2920. \tFRC:
  2921. \tmyprog.o : myprog.c $(FRC) ; ...
  2922. .fi
  2923. .sp
  2924. Works as expected if you issue the command
  2925. .sp
  2926. \t'\fBdmake\fP \-A FRC=FRC'
  2927. .sp
  2928. but fails with a 'don't know how to make FRC'
  2929. error message if you do not specify AUGMAKE special target handling via
  2930. the \-A flag (or by setting AUGMAKE:=yes internally).
  2931. .RE
  2932. .SH "LIMITS"
  2933. In some environments the length of an argument string is restricted.
  2934. (e.g. MSDOS command line arguments cannot be longer than 128 bytes if you are
  2935. using the standard command.com command interpreter as your shell,
  2936. .B dmake
  2937. text diversions may help in these situations.)
  2938. .SH "PORTABILITY"
  2939. To write makefiles that can be moved from one environment to another requires
  2940. some forethought.  In particular you must define as macros all those things
  2941. that may be different in the new environment.
  2942. .B dmake
  2943. has two facilities that help to support writing portable makefiles, recursive
  2944. macros and conditional expressions.  The recursive macros, allow one to define
  2945. environment configurations that allow different environments for similar types
  2946. of operating systems.  For example the same make script can be used for SYSV and
  2947. BSD but with different macro definitions.
  2948. .PP
  2949. To write a makefile that is portable between UNIX and MSDOS requires both
  2950. features since in almost all cases you will need to define new recipes for
  2951. making targets.  The recipes will probably be quite different since the
  2952. capabilities of the tools on each machine are different.  Different
  2953. macros will be needed to help handle the smaller differences in the two
  2954. environments.
  2955. .SH FILES
  2956. Makefile, makefile, startup.mk (use dmake \-V to tell you where the startup
  2957. file is)
  2958. .SH "SEE ALSO"
  2959. sh(1), csh(1), touch(1), f77(1), pc(1), cc(1)
  2960. .br
  2961. S.I. Feldman  \fIMake - A Program for Maintaining Computer Programs\fP
  2962. .SH "AUTHOR"
  2963. Dennis Vadura, CS Dept. University of Waterloo. dvadura@watdragon.uwaterloo.ca
  2964. .br
  2965. Many thanks to Carl Seger for his helpful suggestions,
  2966. and to Trevor John Thompson for his many excellent ideas and
  2967. informative bug reports.
  2968. .SH BUGS
  2969. Some system commands return non-zero status inappropriately.
  2970. Use
  2971. .B \-i
  2972. (`\-' within the makefile) to overcome the difficulty.
  2973. .PP
  2974. Some systems do not have easily accessible
  2975. time stamps for library members (MSDOS, AMIGA, etc)
  2976. for these \fBdmake\fR uses the time stamp of the library instead and prints
  2977. a warning the first time it does so.  This is almost always ok, except when
  2978. multiple makefiles update a single library file.  In these instances it is
  2979. possible to miss an update if one is not careful.
  2980. .PP
  2981. This man page is way too long.
  2982. .SH WARNINGS
  2983. Rules supported by make(1) may not work if transitive closure is turned off
  2984. (-T, .NOINFER).
  2985. .PP
  2986. PWD from csh/ksh will cause problems if a cd operation is performed and
  2987. -e or -E option is used.
  2988. .PP
  2989. Using internal macros such as COMMAND, may wreak havoc if you don't understand
  2990. their functionality.
  2991.